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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:20:27+00:00 2026-06-09T22:20:27+00:00

When trying to add an box with content inside it on a menu on

  • 0

When trying to add an box with content inside it on a menu on a hover “drop down menu”, it does something like this:


(source: gyazo.com)

I want the drop down to popup when I hover on the categories menu item.

This is the code I used for it:

       <div class="secondheader">

      <div class="container">

               <div class="span12">

                          <ul class="nav6">

                          <li><a href="#">Home</a></li>

                          <li class="dropdown1"><a href="#">Categories</a> </li>

                          <li><a href="#">Buy</a></li>

                          <li><a href="#">Sell</a></li>

                          <li><a href="#">Forums</a></li>

                          <li><a href="#">Contact</a></li>

                          <li><a href="#">item 1</a></li>

                          <li><a href="#">Forums</a></li>

                          <li><a href="#">Contact</a></li>

                          <li><a href="#">item 1</a></li>

                          </ul>

                          </div>

               </div>

       </div>

</div>    

The CSS:

.secondheader {
background-image: url("../img/second.png");
width: 100%;
height: 66px;
border-bottom: solid 6px #f0e8ce;
}    

.nav6  {
list-style: none;
font-family: 'Dosis', sans-serif;
float: left
font-size: 20px;
margin-top: 13px;
margin-left: -35px;
}

.nav6  li {
display: inline;
margin: 0px;
font-size: 18px;
font-family: 'Dosis', sans-serif;
float: left;
margin-top: 10px;
}

.nav6 a {
color: #7d7253;
padding-top: 20px;
padding-bottom: 20px;
padding-left: 20px;
padding-right: 20px;
}

.nav6 a:hover {
background-image: url("../img/hoverbg.png");
color: #53410f;
text-decoration: none;
}

I’ve tried using tutorials but I don’t really understand on how to make the same thing for my layout I mean it has different ways and classes.

  • 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-09T22:20:28+00:00Added an answer on June 9, 2026 at 10:20 pm

    Do you want something like http://jsfiddle.net/b76Qc/?

    Edit:

    In your case the submenu is horizontal because you use descendant selectors instead of child selectors:

    replace .nav6 li with .nav6>li and .nav6 li ul with .nav6>li>ul

    See my jsfiddle if you want the complete code.

    Edit 2:

    If you want each element to have a different background,

    <li class="dropdown1"><a href="#">Categories</a>
        <ul>
            <li style="background:red"><a href="#">Buy</a></li>
            <li style="background:blue"><a href="#">Sell</a></li>
            <li style="background:green"><a href="#">Forums</a></li>
            ...
        </ul>
    </li>
    

    But can you provide a link to your site instead of images? The square shown in http://gyazo.com/35835f003d0d8b776248196632cc1d4a.png is weird, but I can’t know what’s happening just with images…

    Edit 3:

    You have to change

    .nav6 a {
        color: #7D7253;
        padding: 20px;
    }
    

    into

    .nav6>li>a {
        padding: 20px;
    }
    .nav6 a {
        color: #7D7253;
    }
    

    And

    .nav6 a:hover {
        background-image: url("../img/hoverbg.png");
        color: #53410F;
        text-decoration: none;
    }
    

    into

    .nav6 a:hover {
        color: #53410F;
        text-decoration: none;
    }
    .nav6 > li > a:hover {
        background-image: url("../img/hoverbg.png");
    }
    

    Edit 4:

    Sorry I didn’t explain why I was telling you to use selectors with >, I thought you knew it.

    Your html is like this:

    <ul class="nav6">
        <li><a href="#">Home</a></li>
        <li class="dropdown1"><a href="#">Categories</a>
            <ul>
                <li><a href="#">Buy</a></li>
                <li><a href="#">Sell</a></li>
                <li><a href="#">Forums</a></li>
                <li><a href="#">Contact</a></li>
                <li><a href="#">item 1</a></li>
                <li><a href="#">Forums</a></li>
                <li><a href="#">Contact</a></li>
                <li><a href="#">item 1</a></li>
            </ul>
        </li>
    </ul>
    

    If you use .nav6 a, the style will be applied to all <a> inside .nav6. That’s a descendant selector.

    Then, this will be applied both to menu’s links and submenu’s links:

    <ul class="nav6">

    <li><a href="#">Home</a></li>

    <li class="dropdown1"><a href="#">Categories</a>

    <ul>

    <li><a href="#">Buy</a></li>

    <li><a href="#">Sell</a></li>

    ...

    </ul>

    </li>

    </ul>

    But if you use a child selector like .nav6>li>a, the style is applied only to the links which are childs of a <li> which is a child of .nav6 (only menu’s links). This way we can set which styles we want to apply to all links and which to menu’s links:

    <ul class="nav6">

    <li><a href="#">Home</a></li>

    <li class="dropdown1"><a href="#">Categories</a>

    <ul>

    <li><a href="#">Buy</a></li>

    <li><a href="#">Sell</a></li>

    ...

    </ul>

    </li>

    </ul>

    Edit 5:

    To fix the problem with backgrounds,

    change

    .nav6 a:hover {
        color: #53410F;
        text-decoration: none;
    }
    

    to

    .nav6>li:hover>a, .nav6 .dropdown1 li:hover>a {
        color: #53410F;
        text-decoration: none;
    }
    

    and

    .nav6 > li > a:hover
        background-image: url("../img/hoverbg.png");
    }
    

    to

    .nav6>li:hover>a {
        background-image: url("../img/hoverbg.png");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display content of the selected row into text box. This code
Trying to add a 'box' to a form at design time, I looked up
I have been trying to add an askquestion dialog box to a delete button
I am trying to add text into a hidden text box in the div
I am trying to add a shadow overlay behind the dialog box. I ran
I am trying to add a Jquery calendar picker to a text box at
I'm trying to add the selected value from the autocomplete search box to my
I am trying to add a label in front of a select box, I
I am trying to make a button to add another input box every time
Im trying to have multiple instances of a tabbed content box, only for some

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.