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 8531623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:31:46+00:00 2026-06-11T09:31:46+00:00

I have a little problem with the active state in CSS. I have a

  • 0

I have a little problem with the “active” state in CSS. I have a <ul> in which there are 4 lists and I want to give these links a different background-color (and stay that way!) if they are clicked. The problem is that this won’t work…

This is my HTML:

<nav id="quick-index-nav">
<ul id="quick-index-list" class="pills slim muted">
<li class="active">
<a id="qindex-popular" title="..." target="right" href="right.php">everything</a>
</li>
<li>
<a id="qindex-today" title="..." target="right" href="right.php?t=tod">today</a>
</li>
<li class="yesterday">
<a id="qindex-yesterday" title="..." target="right" href="right.php?t=yes">tomorrow</a>
</li>
<li>
<a id="qindex-day" title="...." target="right" href="right.php?t=mix">never</a>
</li>
</ul>
</nav>

and this is my CSS file:

#quick-index-nav{margin-bottom:10px; margin-left: -50px;}
#quick-index-list{margin-bottom:0;*zoom:1;border:0px ridge #d9d9d9}
#quick-index-list:before,#quick-index-list:after{display:table;content:""}
#quick-index-list:after{clear:both}
#quick-index-list li{display:inline-block;float:left;width:25%;margin:0;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;border-right:0px ridge #d9d9d9}
#quick-index-list li:nth-child(4n){border-right:0px}
#quick-index-list li:nth-child(n+5){border-top:0px ridge #d9d9d9}
#quick-index-list li>a{padding:0;display:block;font-size:1.0em;text-align:center; font-family: Calibri;}

.pills>li{display:inline-block;margin-bottom:5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;border:1px solid #d9d9d9}
.pills>li>a{padding:6px 10px;cursor:pointer;display:inline-block}
.pills>li>a:hover{text-decoration:none}
.pills>li:hover{background-color:#d9d9d9;text-decoration:none}
.pills>li.active{background-color:#456695;border-color:#456695}
.pills>li.active>a{color:#fff}
.pills.slim>li>a{padding:3px 5px;font-size:.9em}
.pills.muted>li>a{color:gray}
.pills.muted>li.active>a{color:#fff};
.muted {
    color: gray;
}

What is wrong with it?

PS: here is a demo http://jsfiddle.net/1BJK903/fxTQL/5/

  • 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-06-11T09:31:47+00:00Added an answer on June 11, 2026 at 9:31 am

    As I understand, you want to use active pseudo class, than you should have pills>li:active>a. Also, I know like it is applied to links only (never used it and this may be wrong), so possibly you will need to change you class like this: pills>li>a:active

    Update

    After some tests appeared that this pills>li:active>a works in FF, Chrome and IE8+ and does not work in IE7

    To do what you need you can enable jquery on your page with this code. Second script tag contains code which will change classes.

    <script type="text/javascript" scr="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
    <script type="text/javascript">
       $(function(){
       $(".pills li").click(function(){
           $(".pills li").removeClass("active");
           $(this).addClass("active"); 
        })​
    })
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little unusual problem to solve. I need some hint or links to
I have a little problem with the library 'Telerik'. Indeed I want to implement
I have a little problem with a navigation I'm making. I want my navigation
I have a problem with a little .Net web application which uses the Amazon
I have little problem with a replacement of a little part in an url.
I have little problem in regular expressin creation. Expected input: blahblahblah, blahblahblah, 'blahblahblah', blahblahblah,
I have a little problem about the sort direction of a specific column in
I have a little problem with Jquery getJSON function. my json here { entries:
I have a little Problem with the app that I'm developing. In the App
I have a little problem. This is my code: stackPanelShapesContainer = new StackPanel(); InitializeStackPanle();

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.