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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:07:02+00:00 2026-05-30T11:07:02+00:00

I have a problem using first-child I have the following html code to make

  • 0

I have a problem using first-child

I have the following html code to make a menu with first and second levels

<ul id="navMenu"  >
    <li class="parent"><a href="index.html">Home</a> 
    </li>
    <li class="parent"><a href=".html">Products</a>
        <ul ><li><a href="">Software</a>
            <ul>
                <li><a href="">Product 1</a></li>
                <li><a href="">Product 2</a></li>
                <li><a href="">Product 3</a></li>
            </ul>
            </li>
            <li><a href="">Hardware</a>
                <ul>
                    <li><a href="">Product 1</a></li>
                    <li><a href="">Product 2</a></li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

and the following css

#menuContainer{
    float: right;
}

ul#navMenu{
    margin: 25px 0 0;
    list-style: none outside none;
}

ul#navMenu li{
    float: left;
    margin: 0 0 0 0px;
    position: relative;
    z-index: 999;
}

ul#navMenu li a{
    display: block;
    padding: 5px 0px;
    font-size: 13px;
    line-height: 12px;
    background: transparent;
    color: #444;

    -webkit-transition: background-color 0.1s linear, color 0.1s linear;
    -moz-transition: background-color 0.1s linear, color 0.1s linear;
}


ul#navMenu li.parent a{
    padding-right: 23px;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: right top;
    font-family: "Lucida Grande", Tahoma, Arial, sans-serif;
    text-transform: uppercase;


}

ul#navMenu li a:hover, ul#navMenu li.current a{
    color: #CB0167 ;
    text-decoration: none;
    font-family: "Lucida Grande", Tahoma, Arial, sans-serif;

}

ul#navMenu li.parent a:hover, ul#navMenu li.current.parent a{
    background-position: right bottom;
}


/* - -- --- ---- Sub-Menu ---- --- -- - */

ul#navMenu li.parent ul{
    display: none;
    position: absolute;
    top: 25px;
    left: 0;
    width: 160px;
    margin: 0;
    padding: 0px 0 0;
    list-style: none outside none;
    overflow: visible;
    z-index: 99;
    border-top: 1px solid #eee;

}
.noJs ul#navMenu li.parent:hover ul{
    display: block;
}

ul#navMenu li.parent ul li{
    float: none;
    margin: 0;
    padding: 0;

}

ul#navMenu li.parent ul li a{
    display: block;
    padding: 7px 10px;
    color: #444;
    background: #fff;
    font-size: 11px;
    border-right: 1px solid #eee;
    border-left: 1px solid #eee;
    text-transform: none;
    background-image: url('../img/dots_menu.png');
    background-repeat: no-repeat;
}


ul#navMenu li.parent ul li:first-child a{   
    background-image: none;


    }

ul#navMenu li.parent ul li:first-child a:hover{ 
    background-image: none;
    }

ul#navMenu li.parent ul li:last-child a{    
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
    border-bottom: 1px solid #eee;  
}
ul#navMenu li.parent ul li a:hover{
    color: #CB0167 !important;
    background: #fefefe;
    background-image: url('../img/dots_menu.png');
    background-repeat: no-repeat;   
}
/* - -- --- ---- Second Level Sub-Menu ---- --- -- - */

ul#navMenu li.parent ul li ul{
    display: none;
    position: absolute;
    top: -1px;
    left: 159px;
    width: 160px;
    margin: 0;
    padding: 0 0 0 0px;
    border-top: 1px solid #eee;

}

ul#navMenu li.parent ul li ul.leftMenu{
    left: -168px;
    padding: 0 10px 0 0;
}

.noJs ul#navMenu li.parent:hover ul li ul{
    display: none;
}

.noJs ul#navMenu li.parent ul li:hover ul{
    display: block;
}

ul#navMenu li.parent ul li ul li:first-child a{ 
    background-image: none;

}
ul#navMenu li.parent ul li ul li:first-child a:hover{   
    background-image: none;

}

The menu product is exactly what I need , and the hardware menu , but the software menu is not working , any idea how to fix it ??

Thanks a lot 🙂

  • 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-30T11:07:04+00:00Added an answer on May 30, 2026 at 11:07 am

    using the > you can prevent the style affect the grandchild’s , so try to change this

    ul#navMenu li.parent ul li:first-child  a{  
    

    to this

    ul#navMenu li.parent ul li:first-child > a{ 
    

    also

    ul#navMenu li.parent ul li:first-child  a:hover{    
    

    with this

    ul#navMenu li.parent ul li:first-child > a:hover{   
    
    • 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 using template instantiation [*]. file foo.h class Foo {
I have a problem with selecting not first selector using attributeContains jQuery('div[id*=abc]:not(:first)').hide();
I have a problem using JSON and arrays. Here is my code: while($row =
i have a problem using the Catch Clipboard Events code found on this link
I have the following problem using subversion: I'm currently working on the trunk of
I have problem while using jquery maskedinput with asp.net textbox. I have a check
I have a problem using the Java search function in Eclipse on a particular
I have a problem using Linq to NHibernate to load an object and eagerly
I have a problem using the SSIS. I try to import data from database
Greetings, I have a problem using jqgrid and jquery tab (I am coding in

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.