Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Old 12-15-2010, 08:39 PM CSS Last li ul
Experienced Talker

Posts: 40
Name: Andrew Benson
Trades: 0
Hello!
I'm trying to make a new css row that will select the last item in my dropdown menu. This way i can add a rounded corner image that would look nice.
Heres what i have. But what do i need to make the name to be so it gets the last item?
Code:
/* Menu Dropdowns */
#rt-header li ul {background: #222;border: 1px solid #333;}

Thanks
Andrew
djab is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-15-2010, 09:43 PM Re: CSS Last li ul
Mug
Skilled Talker

Posts: 78
Trades: 0
Quote:
Originally Posted by djab View Post
Hello!
I'm trying to make a new css row that will select the last item in my dropdown menu. This way i can add a rounded corner image that would look nice.
Heres what i have. But what do i need to make the name to be so it gets the last item?
Code:
/* Menu Dropdowns */
#rt-header li ul {background: #222;border: 1px solid #333;}
Thanks
Andrew
Hey Andrew

Not really sure what you are after but if you are trying to target the last element of anything you can use the :last-child psuedo class found in CSS2 (not compatible with ie8 and below). If you want it to be supported in IE it may be better using JS. I am not sure if that answers your question?!

There is a simpler way of applying an image to the last element of a list if you know how many items are going to be in that list. You could just apply a class to the final <li >.

All the best,

p.s the code above would work better this way round:

#rt-header ul li {background: #222;border: 1px solid #333;}
__________________
Mug

Please login or register to view this content. Registration is FREE

Last edited by Mug; 12-15-2010 at 09:47 PM..
Mug is offline
Reply With Quote
View Public Profile
 
Old 12-15-2010, 11:17 PM Re: CSS Last li ul
Banned

Posts: 143
Name: maheshadodis
Location: USA
Trades: 0
Make it as follows
<li class="item last"></li>
maheshadodis is offline
Reply With Quote
View Public Profile
 
Old 12-16-2010, 08:43 AM Re: CSS Last li ul
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
No javascript necessary. A simple class as illustrated above will do the job easily enough.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CSS Last li ul
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.26676 seconds with 12 queries