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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:52:11+00:00 2026-06-17T22:52:11+00:00

I have a simple CSS list. I want the first <li> line to be

  • 0

I have a simple CSS list. I want the first <li> line to be shown like is hovered. How can I do this? I had tried something like this: <li class="#menu a:hover"><a href="#">Option 1</a></li> but unfortunately doesn’t work.

Thank you for your time!

The code is:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>A simple menu</title>
<style type="text/css">
#menu a:hover{
    background-color:   yellow;
}
</style>
</head>
 <body>
  <div id="menu">
   <ul>
    <li class="#menu a:hover"><a href="#">Option 1</a></li>
    <li><a href="#">Option 2</a></li>
    <li><a href="#">Option 3</a></li>
    <li><a href="#">Option 4</a></li>
   <ul>
  </div>
 </body>
</html>
  • 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-17T22:52:12+00:00Added an answer on June 17, 2026 at 10:52 pm

    I guess you want the yellow background for first link so do it like this

    #menu ul li:nth-child(1) a {
        background-color:   yellow;
    }
    

    Or simply give a class for example .current

    .current {
       background-color:   yellow;
    }
    
    <div id="menu">
      <ul>
        <li><a href="#" class="current">Option 1</a></li>
        <li><a href="#">Option 2</a></li>
        <li><a href="#">Option 3</a></li>
        <li><a href="#">Option 4</a></li>
      <ul>
    </div>
    

    If you are having any intentions to highlight the current page than answer is NO, you cannot do it with CSS, you will need JavaScript/jQuery or server side programming like PHP

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

Sidebar

Related Questions

I have a simple code that I want to list images like in a
This is probably a basic html/css question... I have a simple one-button form that
I have HTML + CSS text. I need some lib with simple function like
I have a simple list and when I rollover the li selector I want
I'm sure I'm just missing something simple, but I want to change the CSS
I have created a simple dropdown menu using CSS and want to create a
I have a simple test css menu with dropdowns. I want one of the
This is a very simple issue of CSS specificity, but I really can't figure
CSS I have some simple CSS to apply a negative text-indent value on the
I have an anchor tag with some simple CSS: div { background-color: gray; /*

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.