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
Multiple <li> styles in one <ul>?
Old 05-13-2009, 02:57 AM Multiple <li> styles in one <ul>?
Skilled Talker

Posts: 55
Name: Brian
Trades: 0
Hello,

I have been stumped working on this issue for about 2 days now, but havent been able to jump this hurdle:

http://www.transeca.com

My navigation is dynamically created in a loop:

<ul id="glossymenu">
<li>Category</li>
<li>sub category</li>
<li>sub category</li>
<li>Category</li>
<li>sub category</li>
</ul>

If you visit the page, the first <li> is 'Pet GPS' , this is a top level category. The next top level category is all the way at the bottom called 'Test'.

Basically Im trying to assign 2 different styles a 'Category' and 'sub category', my attempt at this is using an id on only the top level <li>'s:

<ul id="glossymenu">
<li id="maincat">Category</li>
<li>sub category</li>
<li>sub category</li>
<li id="maincat">Category</li>
<li>sub category</li>
</ul>

But I dont seem to be able to override the style in this manor:

#maincat li a{
background:#000000;
}

My stylesheet:
http://www.transeca.com/css/style.css

Any advice is deeply appreciated!

Last edited by bmp99; 05-13-2009 at 02:59 AM..
bmp99 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-13-2009, 08:50 AM Re: Multiple <li> styles in one <ul>?
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
First of all, you can't have two id's with the same name. Use classes for that.

Try targeting the links instead of the li since that is what you are styling here <a href="#" class="maincat">
Then in css use:
#glossymenu li a.maincat:link { your styling for this link }

On a side note, your title is all screwed up from using <br />
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Old 05-13-2009, 09:53 AM Re: Multiple <li> styles in one <ul>?
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Also, if you want a multi-level menu, then your structure needs to change from this:

Quote:
<ul id="glossymenu">
<li id="maincat">Category</li>
<li>sub category</li>
<li>sub category</li>
<li id="maincat">Category</li>
<li>sub category</li>
</ul>
To this:

Quote:
<ul id="glossymenu">
<li class="maincat">Category
<ul>
<li>sub category</li>
<li>sub category</li>
</ul>
</li>
<li class="maincat">Category
<ul>
<li>sub category</li>
</ul>
</li>
</ul>
__________________
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 Multiple <li> styles in one <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 0.50194 seconds with 12 queries