Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2012, 03:36 PM   PM User | #1
lmorales
Regular Coder

 
Join Date: Mar 2011
Posts: 192
Thanks: 8
Thanked 1 Time in 1 Post
lmorales is an unknown quantity at this point
Using 2 classes on one selector

I have a navigation that uses the property last, and active. last makes the last list item have no border on the right, active changes the color of the selector when its active. I have one item on my site at trendstudiosorlando.com that uses both,

My classes are
Code:
#navigation li a.last {
border-right:none;
}

#navigation li a.active{
		color: #609;
	}
And here is the call of them
Code:
<li ><a class="active last" href="parties.html" title="Parties">Parties</a></li>
Right now, while the active class works on this, the last is not. Any reason why?
lmorales is offline   Reply With Quote
Old 10-01-2012, 03:58 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
The right border is applied on the list items and so you need to .last last <li> of the navigation. It's correct on all pages except the last page - parties.

PS: Make use of some serverside code (PHP, JSP< ASP) to include a file (with the markup for navigation), on all pages. This will save a lot of time at your end.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 10-01-2012, 04:43 PM   PM User | #3
lmorales
Regular Coder

 
Join Date: Mar 2011
Posts: 192
Thanks: 8
Thanked 1 Time in 1 Post
lmorales is an unknown quantity at this point
Im not sure I understand, sorry.
lmorales is offline   Reply With Quote
Old 10-01-2012, 09:46 PM   PM User | #4
Xherdas
New Coder

 
Join Date: Apr 2012
Posts: 44
Thanks: 0
Thanked 14 Times in 14 Posts
Xherdas is an unknown quantity at this point
The class .active needs to be on your <li> and not on you <a>.

You can also use :last and :active as selectors instead of using them as class. Most of the time is easier and cleaner!

Good luck!

P.S.: Your contact form is almost invisible. Your design is clean, and all the focus should be on that form. ;p

Last edited by Xherdas; 10-01-2012 at 09:50 PM..
Xherdas is offline   Reply With Quote
Old 10-02-2012, 12:32 AM   PM User | #5
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,615
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Quote:
Originally Posted by Xherdas View Post
You can also use :last and :active as selectors instead of using them as class.
No, you can’t.
  1. There is no :last pseudo-class/selector in CSS. There is :last-child but it’s not supported in IE8, so you definitely need another selector for that.
  2. The :active pseudo-class only applies to links while they are clicked, not to “current page” items.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 10-04-2012, 04:40 PM   PM User | #6
lmorales
Regular Coder

 
Join Date: Mar 2011
Posts: 192
Thanks: 8
Thanked 1 Time in 1 Post
lmorales is an unknown quantity at this point
So then how do I put the 2 classes on that one selector?
lmorales is offline   Reply With Quote
Old 10-04-2012, 08:43 PM   PM User | #7
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
Code:
#navigation li a.active.last
is this what you mean?
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:46 PM.


Advertisement
Log in to turn off these ads.