Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Senior Member Blackhawk095's Avatar
    Join Date
    May 2011
    Location
    Kentucky (USA)
    Posts
    384
    Member #
    27969
    Liked
    45 times
    I'm trying to add a "current" class to the navigation in a website I'm building, but it isn't working. This class is supposed to highlight the current page that is being visited. I have never had this issue before.

    Here is my css:

    Code:
    div#main_nav {
        width: 1000px;
        list-style: none;
        margin: 0;
        padding: 0;
        text-align: center;
    }
    
    .main_nav_first {
        border-left: 1px solid #393939;
    }
    
    .current {
        color: #8cb61b;
    }
    
    div#main_nav li {
        float: left;
        font-size: 16px;
        font-family: Arial, Helvetica, sans-serif;
        margin: 0;
        padding: 0;
        list-style: none;
        border-right: 1px solid #393939;
    }
    div#main_nav li a {
        color: #fff;
        display: block;
        margin: 0;
        padding: 5px 15px;
        text-decoration: none;
    }
    
    div#main_nav a:hover {
        color: #8cb61b;
    }
    Here is the HTML for the navigation:

    HTML Code:
    <div id="nav">
            <div id="main_nav">
                <ul>
                    <li class="current main_nav_first"><a href="">Home</a></li>
                    <li><a href="">Members</a></li>
                    <li><a href="">Forum</a></li>
                    <li><a href="">Calendar</a></li>
                    <li><a href="">Rules</a></li>
                    <li><a href="">Trainee's Checklist</a></li>
                    <li><a href="">Videos</a></li>
                </ul>
            </div>
        </div>
    Did I go wrong somewhere?
    [COLOR=rgb(0, 51, 102)]Student Web Designer[/COLOR]
    [COLOR=rgb(0, 51, 102)]If you thought something I said was helpful. LIKE IT![/COLOR]

  2.  

  3. #2
    Senior Member Blackhawk095's Avatar
    Join Date
    May 2011
    Location
    Kentucky (USA)
    Posts
    384
    Member #
    27969
    Liked
    45 times
    By the way, here is the actual website if it is any help:

    http://www.my-testing-area2.netau.ne...rs_of_america/
    [COLOR=rgb(0, 51, 102)]Student Web Designer[/COLOR]
    [COLOR=rgb(0, 51, 102)]If you thought something I said was helpful. LIKE IT![/COLOR]

  4. #3
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    "#main_nav li a" is overriding it, because it is selecting the anchor.
    You'll need to do: current a{color:8cb61b;}
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

a current css not working

,

active page isnt working css

,

css current class

Click on a term to search for related topics.
All times are GMT -6. The time now is 07:40 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com