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

  • Home
  • SEARCH
  • 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 6595403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:56:08+00:00 2026-05-25T17:56:08+00:00

Let me explain what I want. I have the following (partial) HTML. <ul> <li

  • 0

Let me explain what I want. I have the following (partial) HTML.

<ul>
    <li class="positioncommunity"><a href="#">community</a></li>
    <li class="positionsolutions"><a href="#">solutions</a></li>
    <li class="positionmeetings"><a href="#">meetings</a></li>
</ul>

<div id="tab_content">
</div>

community, solutions and meetings are three tabs in the html page. I want to change the “tab_content” div based on which tab a user clicks.

I also want the user to know which tab he is in. So, I want to highlight the tab element. Here is where I am running into the problem. I have the following css for the tab elements.

#leftPan ul li.positioncommunity{padding:20px 0 0 53px;}
#leftPan ul li.positionsolutions{padding:20px 0 0 100px;}
#leftPan ul li.positionmeetings{padding:20px 0 0 40px;}

You can see that I have three CSS classes to position the tab elements. Now, how do I apply a background image to the tab element without changing the CSS class. Specifically, I am looking for a design pattern to separate CSS styling of elements from CSS positioning. Please help me with a NEAT solution to the above problem. I am sure it is a very common problem, but I cannot find a satisfactory solution.

  • 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-25T17:56:09+00:00Added an answer on May 25, 2026 at 5:56 pm

    The most right way is to use additional class for it. Anyway you can set the backgound in javascript (you will have click handler). Without javascript you can’t implement it. Css can’t react to the click event.

    http://jsfiddle.net/KDyky/

    ul li { float:left;  }
    ul li a { margin:2px; padding:3px 7px; display:block; }
    
    $('ul li a').click(function() {
        $('ul li a').css({ background: 'none' });
        $(this).css({ background: 'green' });
        return false;
    });
    

    for the background use your image.

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

Sidebar

Related Questions

I will explain my question on an example. Let's have following code in C#:
Let me try to explain... Lets say I have the following 'a' tags on
I know it is really confusing. Let me explain: I want to open the
Let me explain. Suppose I want to teach Python to someone who only speaks
let me explain my current situation i have a SharePoint site lets say it
Let me explain what I mean : Let's say we have a menu with
First let me explain. I have several addresses on the page that I put
OK, let me explain... I have an NSString and a path stored in it,
I want to find people around X miles let me explain it properly. I
How can I convert the following? 2934 (integer) to B76 (hex) Let me explain

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.