Forum Moderators: not2easy

Message Too Old, No Replies

Could Single Stylesheet Assign Different Colors to Navs?

         

pab1953

2:55 pm on Nov 2, 2007 (gmt 0)

10+ Year Member



I have a site with a left-hand vertical navigation column that's all CSS. The same nav serves about 10 different sections of the site. Is it possible, via a single stylesheet, to assign different color properties to the buttons for each of the 10 sections or will I need a stylesheet for each of them?

Thanks.

penders

4:00 pm on Nov 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can do this with a single stylesheet providing the container for your navigation in each of your 10 sections has a different CLASS or ID. Or if the immediate container is the same, then your sections are on different pages (with an ID set on the BODY perhaps).

For instance...

HTML

<div class="nav" id="section1"> 
<ul>
<li><a href="">menulink1</a></li>
<li><a href="">menulink2</a></li>
<li><a href="">menulink3</a></li>
</ul>
</div>

CSS

#section1 ul li a {} 
#section1 ul li a:hover {}

and then repeat for section2, section3 etc... This then styles just the links within each section (ie. are descendents of).

If each of your navigation menus are basically the same but have just a few differences in each section, then apply a common class to each section ('nav' in this case) which you may have done already and then simply override the differences with your IDs?