Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6031875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:14:59+00:00 2026-05-23T05:14:59+00:00

I have an .active class to apply to li a for the current page.

  • 0

I have an .active class to apply to li a for the current page.

But it keeps being overrode by my styling the main nav div.

#nav ul li a:link, #nav ul li a:visited {
    color: #BBBBBB;
}

#nav ul li a:hover, .active, #nav ul .active a:link, #nav ul .active a:visited {
    border-bottom: red solid 2px;
    padding-bottom: 4px;
    color: #fff;
}

I’ve tried a few variations on the second rule to try and dethrone the first, but none seem to work. (I didn’t have the id in originally, but I know that id is a step above class in the cascade). Maybe I’m missing something really basic, or maybe my first rule is foolishly over specific? (I always seem to be running into this sort of problem with links, specifically)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:15:00+00:00Added an answer on May 23, 2026 at 5:15 am

    Assuming you have markup like this:

    <div id="nav">
      <ul>
        <li><a href="#">foo</a></li>
        <li><a href="#">foo</a></li>
        <li class="active"><a href="#">foo</a></li>
      </ul>
    </div>
    

    Your CSS appears to work fine.

    See http://jsfiddle.net/X7eAw/1/

    You may need to add

    #nav ul li.active a

    to force specificity if the active class is not being applied. That selector is probably overkill however.

    assuming you have the active class on your li element. If you are applying active to the anchor, then the rule should be: #nav ul li a.active:link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this html menu: <ul id='main'> <li class='active current' id='lighty'> <a href='/'>Lighty</a> <ul>
I have a menu within a page, I have an active class applied to
For edit home status of category I have a link: <span class=\ha\ title=\Active in
I want to apply class=active depending what page you on. What the best way
I have 5 elements with same class and at page-load the first div is
I have these links: <a class=active href=#section1>Link 1</a> <a href=#section2>Link 2</a> When a link
I have a standard active record model with an attributes that is required: class
I have implemented a LoginAccess class that prompts the user to enter their active
I have a tree of active record objects, something like: class Part < ActiveRecord::Base
I have an active record class class Service_Catalogue < ActiveRecord::Base set_table_name service_catalogue set_primary_key myKey

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.