Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Display child menu items underneath main menu?

Featured Replies

I am trying to create a new menu underneath the sites main menu, this new menu is to display the child pages of whatever page you are on... hope that makes sense.

 

If not here is a picture of what I am trying to achieve

 

WJaXb.png

 

Hope someone can help me... :-)

You could create a second navigation list...

 

 

<nav>

<h1>Navigation</h1>
  <ul>
  <li><a href="#">Home</a></li>
  <li><a href="#">About</a></li>
  <li><a href="#">Leadership</a></li>
  <li><a href="#">Programs</a></li>
  <li><a href="#">Gallery</a></li>
  <li><a href="#">Members</a></li>
  </ul>

<h2>In this section</h2>

  <ul>
  <li><a href="#">Charter members</a></li>
  <li><a href="#">Past</a></li>
  <li><a href="#">Roster</a></li>
  <li><a href="#">National</a></li>
  <li><a href="#">Regional</a></li>
  </ul>

</nav>
 

Personally I'd go for using 1 nav list but making the sub menu a sub-list of it's parent list item. Then hide it with css until the parent is hovered, and also use php to force the sub-list to be displayed when on any page within that section of the site by dynamically adding an additional class to the nav element.

 

Then your list would read -

<nav>

<ul class="top">
  <li><a href="#">Home</a></li>
  <li><a href="#">About</a>
  <ul class="level_2 <?php echo isset( $results['more_nav'] ? $results['more_nave'] : ''; ?>">
    <li><a href="#">Sub-1</a></li>
    <li><a href="#">Sub-2</a></li>
  </ul></li>
  <li><a href="#">Leadership</a></li>
  <li><a href="#">Programs</a></li>
  <li><a href="#">Gallery</a></li>
  <li><a href="#">Members</a></li>
</ul>

</nav>

Then using display: hidden for the 'nav ul li ul li' as the stadard so that the space is reserved for it and the page won't jump around when the sub menu is displayed and when the 'nav ul li a:hover' condition is met also target the 'nav ul li ul li' and set it's display: inline-block.

 

Simply adding classes to the elements makes it far easier to target the level you are trying to action, both php and java can do that dynamically with ease.

Edited by Weedy101

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.