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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:04:54+00:00 2026-05-17T19:04:54+00:00

I have a web page that, at a certain point, displays a navigation bar

  • 0

I have a web page that, at a certain point, displays a navigation bar which is nothing more than a list (ul) of a elements. Most of the style rules for said a elements is common. The only part that should change is the image to show which can be guessed from the id tag of each li element of the list.

So here’s the question:

Is there a way in CSS to define a something like a “base” style for all the a elements and then set the image depending on the id? Maybe not (CSS Control Inheritance – Inheriting Other Control Styles) but I’d like to be certain.

I tried:

#nav li a {
    /*This would be the 'base' For all the "a"s inside a 
      list inside an element with id=nav (nav -> navigation)*/
 background-color: transparent;
 background-repeat: no-repeat;
 background-position: 0 -58px;
 border-left: thin #444444 solid;
}


#nav li#settings a {
 background: url(../images/nav_settings.png);
}

#nav li#media a {
 background: url(../images/nav_media.png);
}

#nav li#user a {
 background: url(../images/nav_admin.png);
}

But it doesn’t seem to work… The “base” style is overwritten…

Thank you in advance!

  • 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-17T19:04:55+00:00Added an answer on May 17, 2026 at 7:04 pm

    In your particular situation, use the background-image CSS directive. When you use background you’re resetting all of the previously set background-* properties.

    Like this – Example:

    #nav li#settings a {
     background-image: url(../images/nav_settings.png);
    }
    
    #nav li#media a {
     background-image: url(../images/nav_media.png);
    }
    
    #nav li#user a {
     background-image: url(../images/nav_admin.png);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page that displays a long line graph inside a div
I have an ASP.NET web page that displays a variety of fields that need
I have a BasePage which inherits from System.Web.UI.Page , and every page that inherits
I have a web page that includes a bunch of images. Sometimes the image
I have a web page that is being displaying in a winform app using
I have a web page that renders the same in IE7, Firefox, and Safari
Let's say I have a web page that currently accepts a single ID value
I have a simple web page that till now didn't need any login. It
I am working on a web page that is using jQuery. I have an
I have a web page with DIV s with a mouseover handler that is

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.