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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:09:47+00:00 2026-06-05T03:09:47+00:00

I have the following HTML structure: <ul class=container> <li> <a href=# class=option></a> <ul class=submenu>

  • 0

I have the following HTML structure:

<ul class="container">
    <li>
        <a href="#" class="option"></a>
        <ul class="submenu">
            <li><a href="#">Item A</a></li>
            <li><a href="#">Item B</a></li>
         </ul>
     </li>
</ul>

Is it possible, using CSS, change the backgroung position of “option” when the mouse is over “submenu”?

I saw the CSS Referente and i tried to use “>”, “+” and “~”, but it doesn’t work. I don’t know if i am using incorrectly or if it isn’t possible.

Can anybody help me please?

EDIT 1

Here is the CSS that isn’t working:

a.option~ul.submenu:hover {
    background-position:0 -48px;
}

According CSS Referente, in my case, the “~” selects every “ul” element that are preceded by a “a” element, but isn’t working for my code.

  • 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-05T03:09:49+00:00Added an answer on June 5, 2026 at 3:09 am

    The only way to get close to what you are wanting with your html structure is to put a :hover on the li. Something like:

    .container > li:hover > .option {
        background-position: 0 0;
    }
    

    See this fiddle which doesn’t change background-position, but color. When hovering over .submenu there will also be a hover on the parent li.

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

Sidebar

Related Questions

I have the following HTML structure: <div class=outer> <div class=inner> <a href=#/> <a href=#/>
I have the following html structure: <div class=divClass> <a class=aClass href=#> <img src=xxxx.jpg <span
i have following HTML structure: <div class=container> <div class=sidebar></div> <div class=content></div> <div class=subscript></div> </div>
I have the following html structure: <div class=container> <div class=header></div> <div class=sidebar></div> <div class=content-loading></div>
I have the following html structure. <ul> <script id=agendaTmpl type=text/x-jquery-tmpl> <li class=arrow boundElement style=height:40px;
I have the following html structure (which is generated and I can't change): <table
onI have the following html structure: <div> <ul> <li class=gravity-form></li> <li class=gravity-form-divider></li> </ul> </div>
I have the following HTML structure <div id=el> ... <div> ... <div class=x> ...
I have the following HTML structure: <div><a href=link1>blah</a></div> <div><a href=link2>blah</a></div> <div><a href=link3.swf>blah</a></div> <div><a href=link4>blah</a></div>
I have following html: <div id=nav> <ul> <li class=keyitem>keyitem 1</li> <li>item</li> <li>item</li> <li>item</li> <li

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.