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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:21:17+00:00 2026-05-25T21:21:17+00:00

I am setting the style of list items like so: ul.list li { background:

  • 0

I am setting the style of list items like so:

ul.list li {
    background: #FFFFFF;
    padding: 0 5px 0 5px;
    height: 20px;
}

ul.list li:hover {
    background: #F7F7F7;
}

but I want to define a special list item for the title of the list only it inherits the previously defined style too. I know I could just give the above styling a class but that feels cumbersome. Do I have to manually “undo” everything just for the special list item or give the above styling a class? or is there a better way to do it? Maybe I shouldn’t be using a list item for the title?

ul.list li.header {
    font-size: 16px;
    font-weight: bold;
}
  • 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-25T21:21:18+00:00Added an answer on May 25, 2026 at 9:21 pm

    If the title of the list must be inside the list, I’d probably just (as you mentioned) “manually undo” them:

    ul.list li.header {
        font-size: 16px;
        font-weight: bold;
    
        background: transparent;
        padding: 0;
        height: auto;
    }
    

    It’s not so bad.


    If you only need to support modern browsers, you could do this:

    .list li:not(:first-child) {
        background: #FFFFFF;
        padding: 0 5px 0 5px;
        height: 20px;
    }
    .list li:first-child {
        font-size: 16px;
        font-weight: bold;
    }
    
    .list li:hover {
        background: #F7F7F7;
    }
    

    This eliminates the need for any classes (though you could replace :first-child with .header if you do want to keep that class).

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

Sidebar

Related Questions

I want to have automatically created the numbering of a list of items in
I have an unordered list with a background-image set. All list-items have the same
We have a scenario where we want to display a list of items and
I have a list of items displayed horizontally. I want to create a border
I've tried setting the style of the UINavigationbar to be a translucent style in
Setting a Magento store for a winery. They well bottles of wine, but you
I have a list, where SPANs contains a number. I want to copy this
jQuery UI accordion panel contains list of single line menu items. Menu items needs
I want to know how to set the background of a selected item in
Css hover is working correctly until one of the menu items is clicked. I

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.