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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:09:20+00:00 2026-06-17T16:09:20+00:00

I have a problem to apply css to the li element which has specific

  • 0

I have a problem to apply css to the li element which has specific class. I want to change the background color of that li, but I couldnt find a way to do that. I am not sure about if this is changing ‘parent’ since I know css cant control parent.

CSS

.navi ul li { padding:20px; background-color: #00; }


.navi ul li + .current_location { background-color: #FFF; }

or

.navi ul li .current_location { background-color: #FFF; }

//will only change the background color of letters inside, no the li element.

current_location + ul li { background-color: #FFF; }

// will only apply to the children of the li which has class .current_location.



I want to change the li background color where it has class .current_location;

HTML

   <nav class="navi">
            <ul>
              <li>
                <a>General Config</a>
              </li>
              <li class="current_location">
                <a>Menu</a>
              </li>
              <li>
                <a>User Level</a>
              </li>
              <li>
                <a>User</a>
              </li>
              <li>
                <a>Tag</a>
              </li>
              <li>
                <a>Log</a>
              </li>
            </ul>
          </nav>

Thank you very much for your advice

  • 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-17T16:09:21+00:00Added an answer on June 17, 2026 at 4:09 pm

    .navi ul li + .current_location should be .navi ul li.current_location.

    Fiddle

    The + selector is used for selecting next element after the element.
    Ex: div+p will select all p element which are coming after a div element. example

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

Sidebar

Related Questions

I have the following problem: I need to apply a background, which have a
I have a rich:modalPanel which I am styling from external css, But the problem
Anyhow, I have a problem. A tiny problem I suppose, but one that's bugging
I have problem in which I have some rows which I want there to
problem: IE9 I have a table. And i have a CSS class. The CSS
I have a data binding in Knockout to apply a CSS class if a
I have a CSS class called grid which I place on my tables. I
I have problem SIMILAR to preventing form data reposting, but not quite the same
Using jquery I have a clicking tab mechanism that are nothing but anchor tags
I have a problem with adding a dynamic style element with @import statements for

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.