Jump to content

Using Sub Dropdown not working

Recommended Posts


Using the "Navigation Bar with Dropdown", I am creating a dropdown under another dropdown.  When you run it, the dropdown under the dropdown shows as well.  How do I have it so that it doesn't show until I hover over the sub dropdown?

Here is the code

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

<div class="w3-container">
  <h2>Navigation Bar with Dropdown</h2>
  <p>Add a dropdown menu inside the navigation bar:</p>

  <div class="w3-bar w3-light-grey">
    <a href="#" class="w3-bar-item w3-button">Home</a>
    <a href="#" class="w3-bar-item w3-button">Link 1</a>
    <div class="w3-dropdown-hover">
      <button class="w3-button">Dropdown1</button>
      <div class="w3-dropdown-content w3-bar-block w3-card-4">
        <a href="#" class="w3-bar-item w3-button">Link 1</a>
        <a href="#" class="w3-bar-item w3-button">Link 2</a>
        <a href="#" class="w3-bar-item w3-button">Link 3</a>
        <div class="w3-dropdown-hover">
          <button class="w3-button">Dropdown2</button>
          <div class="w3-dropdown-content w3-bar-block w3-card-4">
            <a href="#" class="w3-bar-item w3-button">Link 4</a>
            <a href="#" class="w3-bar-item w3-button">Link 5</a>
            <a href="#" class="w3-bar-item w3-button">Link 6</a>


Thanks in advance for your help!!

Eddi Rae


Link to post
Share on other sites
  • 2 weeks later...
On 4/25/2020 at 5:08 PM, Michele Costantino said:

Is it possible to have link 4,5,6 on the right of of dropdown2 ?

I'm fighting with this since 3 days...

So you can use this css

 position: relative;    
 left: 100%;
  top: 0;

Hope it'll help.


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...