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
Different color for each navbar link
Old 12-21-2009, 12:40 PM Different color for each navbar link
bswinnerton's Avatar
Skilled Talker

Posts: 57
Location: Montville, CT
Trades: 0
Okay, so I have a navigation bar:

Code:
  <div id="navcontainer"> <!-- ending is in footer.php -->
    <div id="navlist_left">
    <ul id="navlist">
      <li class="navlist_1"><a href="/test2/" <?php if($current_page == 'home') { ?> id="navlist_current" <?php } ?>>Home</a></li> 
      <li class="navlist_2"><a href="/test2/blog/" <?php if($current_page == 'blog') { ?> id="navlist_current" <?php } ?>>Blog</a></li>
      <li class="navlist_3"><a href="/test2/news/" <?php if($current_page == 'news') { ?> id="navlist_current" <?php } ?>>News</a></li> 
      <li class="navlist_4"><a href="/test2/reviews/" <?php if($current_page == 'reviews') { ?> id="navlist_current" <?php } ?>>Reviews</a></li>
      <li class="navlist_5"><a href="/test2/websolutions/" <?php if($current_page == 'websolutions') { ?> id="navlist_current" <?php } ?>>Web Solutions</a></li>
      <li class="navlist_6"><a href="/test2/aboutus/" <?php if($current_page == 'aboutus') { ?> id="navlist_current" <?php } ?>>About Us</a></li>
    </ul>
    </div></div>
And the following CSS:

Code:
#navcontainer ul li.navlist_1 a:hover
{
    background-color: #333;
    color: #fff;
    display: inline;
    padding: 3px 5px 3px 5px;
}

#navcontainer ul li.navlist_2 a:hover
{
    background-color: #7ACED7;
    color: #fff;
    display: inline;
    padding: 3px 5px 3px 5px;
}

#navcontainer ul li.navlist_3 a:hover
{
    background-color: #B1D524;
    color: #fff;
    display: inline;
    padding: 3px 5px 3px 5px;
}

#navcontainer ul li.navlist_4 a:hover
{
    background-color: #FFE938;
    color: #fff;
    display: inline;
    padding: 3px 5px 3px 5px;
}

#navcontainer ul li.navlist_5 a:hover
{
    background-color: #FCA02A;
    color: #fff;
    display: inline;
    padding: 3px 5px 3px 5px;
}

#navcontainer ul li.navlist_6 a:hover
{
    background-color: #FA5250;
    color: #fff;
    display: inline;
    padding: 3px 5px 3px 5px;
}

#navlist_current
{
    border-style: solid;
    /* border-color: F00; */
    border-width: 0px 2px 0px 2px;
    margin: 3px 2px 3px 2px;
}
But what I'd like to do is have the different colors of the hover's to go into their own navlist_current.

I've tried #navlist_current.navlist_1 {}, but no luck. How can this be done?

Last edited by bswinnerton; 12-21-2009 at 01:06 PM..
bswinnerton is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-21-2009, 04:11 PM Re: Different color for each navbar link
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
You need a separate class for each nav item applied to the <a>, so you'd need .current1, .current2, etc. and you're html would be a.current1:hover, a.current2:hover etc.
__________________
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
 
Old 12-21-2009, 04:50 PM Re: Different color for each navbar link
bswinnerton's Avatar
Skilled Talker

Posts: 57
Location: Montville, CT
Trades: 0
Quote:
Originally Posted by LadynRed View Post
..and you're html would be a.current1:hover, a.current2:hover etc.
Do you mean CSS?
bswinnerton is offline
Reply With Quote
View Public Profile
 
Old 12-21-2009, 05:02 PM Re: Different color for each navbar link
bswinnerton's Avatar
Skilled Talker

Posts: 57
Location: Montville, CT
Trades: 0
That worked great. Thanks again ladynred
bswinnerton is offline
Reply With Quote
View Public Profile
 
Old 12-22-2009, 11:47 AM Re: Different color for each navbar link
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Guess you figured it out
__________________
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
 
Old 12-22-2009, 11:48 AM Re: Different color for each navbar link
bswinnerton's Avatar
Skilled Talker

Posts: 57
Location: Montville, CT
Trades: 0
I did
bswinnerton is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Different color for each navbar link
 

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.70207 seconds with 12 queries