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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:37:44+00:00 2026-05-28T15:37:44+00:00

I want to set an active class for a CSS image menu. I tried

  • 0

I want to set an active class for a CSS image menu. I tried to set the active selector to be the same as the hover selector, but it didn’t work.

CSS

#menu li a.fooa {
    background-image: url(/images/foo_a.png);
    height: 20px;
    width: 20px;
}

#menu li a.foob {
    background-image: url(/images/foo_b.png);
    height: 20px;
    width: 20px;
    margin-left:-8px;
}

#topmenu li a:hover, #topmenu li a:active {
    background-position: left bottom;
    height: 20px;
    width: 20px;
}

HTML

<ul id="foo_menu">
<li><a href="/fooA" class="fooa qtipmenu" id="foo_A"></a></li>
<li><a href="/fooB" class="foob qtipmenu" id="foo_B"></a></li>
</ul>

(I have 2 classes for each href because I’m using the qtip2 popups. I’ve tried to set the active class without including the 2nd (qtip2) class, but haven’t been able to get the active class to work that way either.)

  • 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-28T15:37:45+00:00Added an answer on May 28, 2026 at 3:37 pm

    the pseudo-selector :active doesn’t set an element to active. It Selects the active link, which means only the time, when the mouse is clicked on the element until it’s released!
    What you need ist to apply an class="active" on your element:

    When link #1 is active:

    <ul id="foo_menu">
      <li><a href="/fooA" class="fooa qtipmenu active" id="foo_A"></a></li>
      <li><a href="/fooB" class="foob qtipmenu" id="foo_B"></a></li>
    </ul>
    

    And CSS changes to:

    #topmenu li a:focus,
    #topmenu li a:hover,
    #topmenu li a.active {
        background-position: left bottom;
        height: 20px;
        width: 20px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Complex CSS selector for parent of active child I want to match
I am building menu with jquery, and I have set active class to selected
I want set Listbox background to transparent but not working Is there any idea?
I want to set a background image for a div, in a way that
I want to set a breakpoint on the __DoPostBack method, but it's a pain
I want to set some attributes just before the object is serialized, but as
Here is my template code: <li class={$product.name} {if $product.name == $filter_product.name}class=active{/if}> I want to
I have this set of html and css. What I want is to have
I am trying to build a menu with an active page element for CSS
I want set interfaceOrientation in one UIView as LandscapeLeft and Portrait in other UIView.

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.