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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:11:02+00:00 2026-05-14T01:11:02+00:00

I have a nav bar with children unordered lists nested under the main navbar

  • 0

I have a nav bar with children unordered lists nested under the main navbar items. My problem is on the inner list, when I position absolute, the inner list is centered to the page, and when I position relative, it is positioning inline with the parent list.

I’m trying to get the first child item to line up directly under it’s parent.

/*  OUTER LIST STYLING  */

div#navbar2 {

    position:relative;
    width: 100%;
    border-top: solid #000 1px;
    border-bottom: solid #546F8B 1px;
    background-color: #546F8B;
}

div#navbar2 ul#navbar {
    padding: 0;
    margin: 10px 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    letter-spacing:1px;
    color: #FFF;
    white-space: nowrap;

}

div#navbar2 ul#navbar li {
    margin: 0 2px;
    list-style-type: none;
    display: inline;
}


div#navbar2 li a {
   text-decoration: none;
   color: #fff;
   padding: 10px 10px;
}

div#navbar2 li a:link {
    color: #FFF:
}

div#navbar2 li a:visited {
    color: #ffffff;
}

div#navbar2 li a:hover {
    color: #000;
    background-color: #FDFFC9;
}

/*   INNER LIST STYLING   */

div#navbar2 ul#navbar li ul.innerlist{
    display: none; 
    color:#000;

}
div#navbar2 ul#navbar li ul.innerlist li{
    color:#000;
}


div#navbar2 ul#navbar li:hover ul.innerlist {
    position: absolute;
    display: inline;
    left: 0;
    width: 100%;
    margin: 40px 0 0px 0px;
    padding: 0px; 
    color:#000;
    }

div#navbar2 li.innerlist a {
   text-decoration: none;
   color: #000;
    padding: 10px 10px;
}

div#navbar2 li.innerlist a:link {
    color: #000:
}

div#navbar2 li.innerlist a:visited {
    color: #000;
}

div#navbar2 li.innerlist a:hover {

    color: #000;
    background-color: #FDFFC9;
}

And my html:

<div id="navbar2">

<ul id="navbar">
  <li id="index"><a href="index.php">About Rattletree</a></li>
  <li id="upcomingshows"><a href="upcomingshows.php">Calendar</a></li>
  <li id="booking"><a href="booking.php">Contact</a>
            <ul class="innerlist">
                <li class="innerlist"><a href="#">Booking</a></li>
                <li class="innerlist"><a href="#">press</a></li>
            </ul>
  </li>
  <li id="instruments"><a href="instruments.php">The Band</a>
            <ul class="innerlist">
                <li class="innerlist"><a href="#">The Instruments</a></li>
                <li class="innerlist"><a href="#">The Players</a></li>
            </ul>
  </li>
  <li id="classes"><a href="classes.php">Sights &amp; Sounds</a>
            <ul class="innerlist">
                <li class="innerlist"><a href="#">Listen</a></li>
                <li class="innerlist"><a href="#">photos</a></li>
                <li class="innerlist"><a href="#">video</a></li>
            </ul>
  </li>
  <li id"classes"><a href="classes.php">Workshops &amp; Classes</a></li>


</ul>
</div>

Thanks for any help!

  • 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-14T01:11:03+00:00Added an answer on May 14, 2026 at 1:11 am

    If you set the #navbar > li {position: relative;} and the ul.innerlist {position: absolute; } then it, and its descendant li elements, will be positioned in relation to the #navbar > lis instead of the page.

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

Sidebar

Related Questions

I have a navigation bar that has two dropdowns (as nested ul's). I'm trying
I have nav a bar on my site but I want to put rounded
I have a nav bar with a drop down that is working beautifully. The
Okay so i have a nav bar on top of the webpage and on
I have an iPhone app in development that requires three slides (views). The problem
I have a navbar that drops down. The parent text is black, when you
I have found this example on StackOverflow: var people = new List<Person> { new
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution

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.