Navigation drop down menu CSS





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am trying to position the nav on the right side in the middle of the header area. like cyberchimps



enter image description here



Also when I hover over sub menu of BGA I would like to keep hover state on for BGA. I'm not sure how to accomplish this.



I have seen "*" in CSS on a few examples, is that a good practice to use today?



I am doubtful that my approach is sound any suggestions are welcomed.






@charset "utf-8";
/* CSS Document */
body{
margin: 0;
padding: 0;
background-color: #CCC;
}

@font-face{
src: url(assets/fonts/oswald-v16-latin-regular.ttf);
font-family: oswald;
}

/* ~~ The header is given a width of 100%.
It will extend the full width of the browser.
The rest of the layout will be fixed~~ */
header{
background-color: #004489;
min-width: 1024px;
height: 100px;
clear: both;
}
/*header::after {
content: '';
display: block;
clear: both;
}*/
.navWrapper{
max-width: 1100px;
margin: 0 auto;
}

nav{
float:right;
margin-top: 20px;
padding-right: 50px;
}

nav ul{
list-style: none;
padding: 0;
margin: 0;

}

nav ul li{
display: inline-block;
float: left;
position: relative;

}

nav ul li a{
display: block;
margin: 0;
padding: 10px 10px;
text-decoration: none;
font-family: oswald;
font-size: 25px;
color: #fff;
}


nav ul a:hover, nav ul a:active, nav ul a:focus{
background-color: #065BB0;
}

nav ul ul{
display: none;/**/
position: absolute;
}

/* Display Dropdowns on Hover */
nav ul li:hover > ul {
display:list-item;
}
nav ul ul li{
display: block;
width: 115px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
nav ul ul li a{
color:#242323;
background-color: #8ec6ef;

}
nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
color:#fff;
background-color: #065BB0;
}

<body>
<header>
<div class="navWrapper">
<nav>
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">BGA</a>
<ul>
<li><a href="#">BOOKS</a></li>
<li><a href="#">COURSES</a></li>
</ul>
</li>
<li><a href="#">CONTACT</a></li>
</ul>
</nav>
</div>
</header>
</body>












share|improve this question





























    0















    I am trying to position the nav on the right side in the middle of the header area. like cyberchimps



    enter image description here



    Also when I hover over sub menu of BGA I would like to keep hover state on for BGA. I'm not sure how to accomplish this.



    I have seen "*" in CSS on a few examples, is that a good practice to use today?



    I am doubtful that my approach is sound any suggestions are welcomed.






    @charset "utf-8";
    /* CSS Document */
    body{
    margin: 0;
    padding: 0;
    background-color: #CCC;
    }

    @font-face{
    src: url(assets/fonts/oswald-v16-latin-regular.ttf);
    font-family: oswald;
    }

    /* ~~ The header is given a width of 100%.
    It will extend the full width of the browser.
    The rest of the layout will be fixed~~ */
    header{
    background-color: #004489;
    min-width: 1024px;
    height: 100px;
    clear: both;
    }
    /*header::after {
    content: '';
    display: block;
    clear: both;
    }*/
    .navWrapper{
    max-width: 1100px;
    margin: 0 auto;
    }

    nav{
    float:right;
    margin-top: 20px;
    padding-right: 50px;
    }

    nav ul{
    list-style: none;
    padding: 0;
    margin: 0;

    }

    nav ul li{
    display: inline-block;
    float: left;
    position: relative;

    }

    nav ul li a{
    display: block;
    margin: 0;
    padding: 10px 10px;
    text-decoration: none;
    font-family: oswald;
    font-size: 25px;
    color: #fff;
    }


    nav ul a:hover, nav ul a:active, nav ul a:focus{
    background-color: #065BB0;
    }

    nav ul ul{
    display: none;/**/
    position: absolute;
    }

    /* Display Dropdowns on Hover */
    nav ul li:hover > ul {
    display:list-item;
    }
    nav ul ul li{
    display: block;
    width: 115px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    }
    nav ul ul li a{
    color:#242323;
    background-color: #8ec6ef;

    }
    nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
    color:#fff;
    background-color: #065BB0;
    }

    <body>
    <header>
    <div class="navWrapper">
    <nav>
    <ul>
    <li><a href="#">HOME</a></li>
    <li><a href="#">BGA</a>
    <ul>
    <li><a href="#">BOOKS</a></li>
    <li><a href="#">COURSES</a></li>
    </ul>
    </li>
    <li><a href="#">CONTACT</a></li>
    </ul>
    </nav>
    </div>
    </header>
    </body>












    share|improve this question

























      0












      0








      0








      I am trying to position the nav on the right side in the middle of the header area. like cyberchimps



      enter image description here



      Also when I hover over sub menu of BGA I would like to keep hover state on for BGA. I'm not sure how to accomplish this.



      I have seen "*" in CSS on a few examples, is that a good practice to use today?



      I am doubtful that my approach is sound any suggestions are welcomed.






      @charset "utf-8";
      /* CSS Document */
      body{
      margin: 0;
      padding: 0;
      background-color: #CCC;
      }

      @font-face{
      src: url(assets/fonts/oswald-v16-latin-regular.ttf);
      font-family: oswald;
      }

      /* ~~ The header is given a width of 100%.
      It will extend the full width of the browser.
      The rest of the layout will be fixed~~ */
      header{
      background-color: #004489;
      min-width: 1024px;
      height: 100px;
      clear: both;
      }
      /*header::after {
      content: '';
      display: block;
      clear: both;
      }*/
      .navWrapper{
      max-width: 1100px;
      margin: 0 auto;
      }

      nav{
      float:right;
      margin-top: 20px;
      padding-right: 50px;
      }

      nav ul{
      list-style: none;
      padding: 0;
      margin: 0;

      }

      nav ul li{
      display: inline-block;
      float: left;
      position: relative;

      }

      nav ul li a{
      display: block;
      margin: 0;
      padding: 10px 10px;
      text-decoration: none;
      font-family: oswald;
      font-size: 25px;
      color: #fff;
      }


      nav ul a:hover, nav ul a:active, nav ul a:focus{
      background-color: #065BB0;
      }

      nav ul ul{
      display: none;/**/
      position: absolute;
      }

      /* Display Dropdowns on Hover */
      nav ul li:hover > ul {
      display:list-item;
      }
      nav ul ul li{
      display: block;
      width: 115px;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
      }
      nav ul ul li a{
      color:#242323;
      background-color: #8ec6ef;

      }
      nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
      color:#fff;
      background-color: #065BB0;
      }

      <body>
      <header>
      <div class="navWrapper">
      <nav>
      <ul>
      <li><a href="#">HOME</a></li>
      <li><a href="#">BGA</a>
      <ul>
      <li><a href="#">BOOKS</a></li>
      <li><a href="#">COURSES</a></li>
      </ul>
      </li>
      <li><a href="#">CONTACT</a></li>
      </ul>
      </nav>
      </div>
      </header>
      </body>












      share|improve this question














      I am trying to position the nav on the right side in the middle of the header area. like cyberchimps



      enter image description here



      Also when I hover over sub menu of BGA I would like to keep hover state on for BGA. I'm not sure how to accomplish this.



      I have seen "*" in CSS on a few examples, is that a good practice to use today?



      I am doubtful that my approach is sound any suggestions are welcomed.






      @charset "utf-8";
      /* CSS Document */
      body{
      margin: 0;
      padding: 0;
      background-color: #CCC;
      }

      @font-face{
      src: url(assets/fonts/oswald-v16-latin-regular.ttf);
      font-family: oswald;
      }

      /* ~~ The header is given a width of 100%.
      It will extend the full width of the browser.
      The rest of the layout will be fixed~~ */
      header{
      background-color: #004489;
      min-width: 1024px;
      height: 100px;
      clear: both;
      }
      /*header::after {
      content: '';
      display: block;
      clear: both;
      }*/
      .navWrapper{
      max-width: 1100px;
      margin: 0 auto;
      }

      nav{
      float:right;
      margin-top: 20px;
      padding-right: 50px;
      }

      nav ul{
      list-style: none;
      padding: 0;
      margin: 0;

      }

      nav ul li{
      display: inline-block;
      float: left;
      position: relative;

      }

      nav ul li a{
      display: block;
      margin: 0;
      padding: 10px 10px;
      text-decoration: none;
      font-family: oswald;
      font-size: 25px;
      color: #fff;
      }


      nav ul a:hover, nav ul a:active, nav ul a:focus{
      background-color: #065BB0;
      }

      nav ul ul{
      display: none;/**/
      position: absolute;
      }

      /* Display Dropdowns on Hover */
      nav ul li:hover > ul {
      display:list-item;
      }
      nav ul ul li{
      display: block;
      width: 115px;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
      }
      nav ul ul li a{
      color:#242323;
      background-color: #8ec6ef;

      }
      nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
      color:#fff;
      background-color: #065BB0;
      }

      <body>
      <header>
      <div class="navWrapper">
      <nav>
      <ul>
      <li><a href="#">HOME</a></li>
      <li><a href="#">BGA</a>
      <ul>
      <li><a href="#">BOOKS</a></li>
      <li><a href="#">COURSES</a></li>
      </ul>
      </li>
      <li><a href="#">CONTACT</a></li>
      </ul>
      </nav>
      </div>
      </header>
      </body>








      @charset "utf-8";
      /* CSS Document */
      body{
      margin: 0;
      padding: 0;
      background-color: #CCC;
      }

      @font-face{
      src: url(assets/fonts/oswald-v16-latin-regular.ttf);
      font-family: oswald;
      }

      /* ~~ The header is given a width of 100%.
      It will extend the full width of the browser.
      The rest of the layout will be fixed~~ */
      header{
      background-color: #004489;
      min-width: 1024px;
      height: 100px;
      clear: both;
      }
      /*header::after {
      content: '';
      display: block;
      clear: both;
      }*/
      .navWrapper{
      max-width: 1100px;
      margin: 0 auto;
      }

      nav{
      float:right;
      margin-top: 20px;
      padding-right: 50px;
      }

      nav ul{
      list-style: none;
      padding: 0;
      margin: 0;

      }

      nav ul li{
      display: inline-block;
      float: left;
      position: relative;

      }

      nav ul li a{
      display: block;
      margin: 0;
      padding: 10px 10px;
      text-decoration: none;
      font-family: oswald;
      font-size: 25px;
      color: #fff;
      }


      nav ul a:hover, nav ul a:active, nav ul a:focus{
      background-color: #065BB0;
      }

      nav ul ul{
      display: none;/**/
      position: absolute;
      }

      /* Display Dropdowns on Hover */
      nav ul li:hover > ul {
      display:list-item;
      }
      nav ul ul li{
      display: block;
      width: 115px;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
      }
      nav ul ul li a{
      color:#242323;
      background-color: #8ec6ef;

      }
      nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
      color:#fff;
      background-color: #065BB0;
      }

      <body>
      <header>
      <div class="navWrapper">
      <nav>
      <ul>
      <li><a href="#">HOME</a></li>
      <li><a href="#">BGA</a>
      <ul>
      <li><a href="#">BOOKS</a></li>
      <li><a href="#">COURSES</a></li>
      </ul>
      </li>
      <li><a href="#">CONTACT</a></li>
      </ul>
      </nav>
      </div>
      </header>
      </body>





      @charset "utf-8";
      /* CSS Document */
      body{
      margin: 0;
      padding: 0;
      background-color: #CCC;
      }

      @font-face{
      src: url(assets/fonts/oswald-v16-latin-regular.ttf);
      font-family: oswald;
      }

      /* ~~ The header is given a width of 100%.
      It will extend the full width of the browser.
      The rest of the layout will be fixed~~ */
      header{
      background-color: #004489;
      min-width: 1024px;
      height: 100px;
      clear: both;
      }
      /*header::after {
      content: '';
      display: block;
      clear: both;
      }*/
      .navWrapper{
      max-width: 1100px;
      margin: 0 auto;
      }

      nav{
      float:right;
      margin-top: 20px;
      padding-right: 50px;
      }

      nav ul{
      list-style: none;
      padding: 0;
      margin: 0;

      }

      nav ul li{
      display: inline-block;
      float: left;
      position: relative;

      }

      nav ul li a{
      display: block;
      margin: 0;
      padding: 10px 10px;
      text-decoration: none;
      font-family: oswald;
      font-size: 25px;
      color: #fff;
      }


      nav ul a:hover, nav ul a:active, nav ul a:focus{
      background-color: #065BB0;
      }

      nav ul ul{
      display: none;/**/
      position: absolute;
      }

      /* Display Dropdowns on Hover */
      nav ul li:hover > ul {
      display:list-item;
      }
      nav ul ul li{
      display: block;
      width: 115px;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
      }
      nav ul ul li a{
      color:#242323;
      background-color: #8ec6ef;

      }
      nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
      color:#fff;
      background-color: #065BB0;
      }

      <body>
      <header>
      <div class="navWrapper">
      <nav>
      <ul>
      <li><a href="#">HOME</a></li>
      <li><a href="#">BGA</a>
      <ul>
      <li><a href="#">BOOKS</a></li>
      <li><a href="#">COURSES</a></li>
      </ul>
      </li>
      <li><a href="#">CONTACT</a></li>
      </ul>
      </nav>
      </div>
      </header>
      </body>






      html css drop-down-menu header navbar






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 21:55









      James ParkerJames Parker

      467




      467
























          1 Answer
          1






          active

          oldest

          votes


















          1














          I don't think it is possible with CSS, you can simply do it by using jQuery mouseenter event:




          $('#bga-list').mouseenter(() => {
          $('#bga-list > ul').show();
          })

          @charset "utf-8";
          /* CSS Document */
          body{
          margin: 0;
          padding: 0;
          background-color: #CCC;
          }

          @font-face{
          src: url(assets/fonts/oswald-v16-latin-regular.ttf);
          font-family: oswald;
          }

          /* ~~ The header is given a width of 100%.
          It will extend the full width of the browser.
          The rest of the layout will be fixed~~ */
          header{
          background-color: #004489;
          min-width: 1024px;
          height: 100px;
          clear: both;
          }
          /*header::after {
          content: '';
          display: block;
          clear: both;
          }*/
          .navWrapper{
          max-width: 1100px;
          margin: 0 auto;
          }

          nav{
          float:right;
          margin-top: 20px;
          padding-right: 50px;
          }

          nav ul{
          list-style: none;
          padding: 0;
          margin: 0;

          }

          nav ul li{
          display: inline-block;
          float: left;
          position: relative;

          }

          nav ul li a{
          display: block;
          margin: 0;
          padding: 10px 10px;
          text-decoration: none;
          font-family: oswald;
          font-size: 25px;
          color: #fff;
          }


          nav ul a:hover, nav ul a:active, nav ul a:focus{
          background-color: #065BB0;
          }

          nav ul ul{
          display: none;/**/
          position: absolute;
          }

          /* Display Dropdowns on Hover */

          nav ul ul li{
          display: block;
          width: 115px;
          box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
          }
          nav ul ul li a{
          color:#242323;
          background-color: #8ec6ef;

          }
          nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
          color:#fff;
          background-color: #065BB0;
          }

          <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
          <body>
          <header>
          <div class="navWrapper">
          <nav>
          <ul>
          <li><a href="#">HOME</a></li>
          <li id="bga-list"><a href="#">BGA</a>
          <ul>
          <li><a href="#">BOOKS</a></li>
          <li><a href="#">COURSES</a></li>
          </ul>
          </li>
          <li><a href="#">CONTACT</a></li>
          </ul>
          </nav>
          </div>
          </header>
          </body>





          However, I don't think it's a good idea to show a dropdown list on mouseenter and never hide it. Hope this helps.






          share|improve this answer


























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345960%2fnavigation-drop-down-menu-css%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            I don't think it is possible with CSS, you can simply do it by using jQuery mouseenter event:




            $('#bga-list').mouseenter(() => {
            $('#bga-list > ul').show();
            })

            @charset "utf-8";
            /* CSS Document */
            body{
            margin: 0;
            padding: 0;
            background-color: #CCC;
            }

            @font-face{
            src: url(assets/fonts/oswald-v16-latin-regular.ttf);
            font-family: oswald;
            }

            /* ~~ The header is given a width of 100%.
            It will extend the full width of the browser.
            The rest of the layout will be fixed~~ */
            header{
            background-color: #004489;
            min-width: 1024px;
            height: 100px;
            clear: both;
            }
            /*header::after {
            content: '';
            display: block;
            clear: both;
            }*/
            .navWrapper{
            max-width: 1100px;
            margin: 0 auto;
            }

            nav{
            float:right;
            margin-top: 20px;
            padding-right: 50px;
            }

            nav ul{
            list-style: none;
            padding: 0;
            margin: 0;

            }

            nav ul li{
            display: inline-block;
            float: left;
            position: relative;

            }

            nav ul li a{
            display: block;
            margin: 0;
            padding: 10px 10px;
            text-decoration: none;
            font-family: oswald;
            font-size: 25px;
            color: #fff;
            }


            nav ul a:hover, nav ul a:active, nav ul a:focus{
            background-color: #065BB0;
            }

            nav ul ul{
            display: none;/**/
            position: absolute;
            }

            /* Display Dropdowns on Hover */

            nav ul ul li{
            display: block;
            width: 115px;
            box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
            }
            nav ul ul li a{
            color:#242323;
            background-color: #8ec6ef;

            }
            nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
            color:#fff;
            background-color: #065BB0;
            }

            <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
            <body>
            <header>
            <div class="navWrapper">
            <nav>
            <ul>
            <li><a href="#">HOME</a></li>
            <li id="bga-list"><a href="#">BGA</a>
            <ul>
            <li><a href="#">BOOKS</a></li>
            <li><a href="#">COURSES</a></li>
            </ul>
            </li>
            <li><a href="#">CONTACT</a></li>
            </ul>
            </nav>
            </div>
            </header>
            </body>





            However, I don't think it's a good idea to show a dropdown list on mouseenter and never hide it. Hope this helps.






            share|improve this answer






























              1














              I don't think it is possible with CSS, you can simply do it by using jQuery mouseenter event:




              $('#bga-list').mouseenter(() => {
              $('#bga-list > ul').show();
              })

              @charset "utf-8";
              /* CSS Document */
              body{
              margin: 0;
              padding: 0;
              background-color: #CCC;
              }

              @font-face{
              src: url(assets/fonts/oswald-v16-latin-regular.ttf);
              font-family: oswald;
              }

              /* ~~ The header is given a width of 100%.
              It will extend the full width of the browser.
              The rest of the layout will be fixed~~ */
              header{
              background-color: #004489;
              min-width: 1024px;
              height: 100px;
              clear: both;
              }
              /*header::after {
              content: '';
              display: block;
              clear: both;
              }*/
              .navWrapper{
              max-width: 1100px;
              margin: 0 auto;
              }

              nav{
              float:right;
              margin-top: 20px;
              padding-right: 50px;
              }

              nav ul{
              list-style: none;
              padding: 0;
              margin: 0;

              }

              nav ul li{
              display: inline-block;
              float: left;
              position: relative;

              }

              nav ul li a{
              display: block;
              margin: 0;
              padding: 10px 10px;
              text-decoration: none;
              font-family: oswald;
              font-size: 25px;
              color: #fff;
              }


              nav ul a:hover, nav ul a:active, nav ul a:focus{
              background-color: #065BB0;
              }

              nav ul ul{
              display: none;/**/
              position: absolute;
              }

              /* Display Dropdowns on Hover */

              nav ul ul li{
              display: block;
              width: 115px;
              box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
              }
              nav ul ul li a{
              color:#242323;
              background-color: #8ec6ef;

              }
              nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
              color:#fff;
              background-color: #065BB0;
              }

              <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
              <body>
              <header>
              <div class="navWrapper">
              <nav>
              <ul>
              <li><a href="#">HOME</a></li>
              <li id="bga-list"><a href="#">BGA</a>
              <ul>
              <li><a href="#">BOOKS</a></li>
              <li><a href="#">COURSES</a></li>
              </ul>
              </li>
              <li><a href="#">CONTACT</a></li>
              </ul>
              </nav>
              </div>
              </header>
              </body>





              However, I don't think it's a good idea to show a dropdown list on mouseenter and never hide it. Hope this helps.






              share|improve this answer




























                1












                1








                1







                I don't think it is possible with CSS, you can simply do it by using jQuery mouseenter event:




                $('#bga-list').mouseenter(() => {
                $('#bga-list > ul').show();
                })

                @charset "utf-8";
                /* CSS Document */
                body{
                margin: 0;
                padding: 0;
                background-color: #CCC;
                }

                @font-face{
                src: url(assets/fonts/oswald-v16-latin-regular.ttf);
                font-family: oswald;
                }

                /* ~~ The header is given a width of 100%.
                It will extend the full width of the browser.
                The rest of the layout will be fixed~~ */
                header{
                background-color: #004489;
                min-width: 1024px;
                height: 100px;
                clear: both;
                }
                /*header::after {
                content: '';
                display: block;
                clear: both;
                }*/
                .navWrapper{
                max-width: 1100px;
                margin: 0 auto;
                }

                nav{
                float:right;
                margin-top: 20px;
                padding-right: 50px;
                }

                nav ul{
                list-style: none;
                padding: 0;
                margin: 0;

                }

                nav ul li{
                display: inline-block;
                float: left;
                position: relative;

                }

                nav ul li a{
                display: block;
                margin: 0;
                padding: 10px 10px;
                text-decoration: none;
                font-family: oswald;
                font-size: 25px;
                color: #fff;
                }


                nav ul a:hover, nav ul a:active, nav ul a:focus{
                background-color: #065BB0;
                }

                nav ul ul{
                display: none;/**/
                position: absolute;
                }

                /* Display Dropdowns on Hover */

                nav ul ul li{
                display: block;
                width: 115px;
                box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
                }
                nav ul ul li a{
                color:#242323;
                background-color: #8ec6ef;

                }
                nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
                color:#fff;
                background-color: #065BB0;
                }

                <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
                <body>
                <header>
                <div class="navWrapper">
                <nav>
                <ul>
                <li><a href="#">HOME</a></li>
                <li id="bga-list"><a href="#">BGA</a>
                <ul>
                <li><a href="#">BOOKS</a></li>
                <li><a href="#">COURSES</a></li>
                </ul>
                </li>
                <li><a href="#">CONTACT</a></li>
                </ul>
                </nav>
                </div>
                </header>
                </body>





                However, I don't think it's a good idea to show a dropdown list on mouseenter and never hide it. Hope this helps.






                share|improve this answer















                I don't think it is possible with CSS, you can simply do it by using jQuery mouseenter event:




                $('#bga-list').mouseenter(() => {
                $('#bga-list > ul').show();
                })

                @charset "utf-8";
                /* CSS Document */
                body{
                margin: 0;
                padding: 0;
                background-color: #CCC;
                }

                @font-face{
                src: url(assets/fonts/oswald-v16-latin-regular.ttf);
                font-family: oswald;
                }

                /* ~~ The header is given a width of 100%.
                It will extend the full width of the browser.
                The rest of the layout will be fixed~~ */
                header{
                background-color: #004489;
                min-width: 1024px;
                height: 100px;
                clear: both;
                }
                /*header::after {
                content: '';
                display: block;
                clear: both;
                }*/
                .navWrapper{
                max-width: 1100px;
                margin: 0 auto;
                }

                nav{
                float:right;
                margin-top: 20px;
                padding-right: 50px;
                }

                nav ul{
                list-style: none;
                padding: 0;
                margin: 0;

                }

                nav ul li{
                display: inline-block;
                float: left;
                position: relative;

                }

                nav ul li a{
                display: block;
                margin: 0;
                padding: 10px 10px;
                text-decoration: none;
                font-family: oswald;
                font-size: 25px;
                color: #fff;
                }


                nav ul a:hover, nav ul a:active, nav ul a:focus{
                background-color: #065BB0;
                }

                nav ul ul{
                display: none;/**/
                position: absolute;
                }

                /* Display Dropdowns on Hover */

                nav ul ul li{
                display: block;
                width: 115px;
                box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
                }
                nav ul ul li a{
                color:#242323;
                background-color: #8ec6ef;

                }
                nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
                color:#fff;
                background-color: #065BB0;
                }

                <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
                <body>
                <header>
                <div class="navWrapper">
                <nav>
                <ul>
                <li><a href="#">HOME</a></li>
                <li id="bga-list"><a href="#">BGA</a>
                <ul>
                <li><a href="#">BOOKS</a></li>
                <li><a href="#">COURSES</a></li>
                </ul>
                </li>
                <li><a href="#">CONTACT</a></li>
                </ul>
                </nav>
                </div>
                </header>
                </body>





                However, I don't think it's a good idea to show a dropdown list on mouseenter and never hide it. Hope this helps.






                $('#bga-list').mouseenter(() => {
                $('#bga-list > ul').show();
                })

                @charset "utf-8";
                /* CSS Document */
                body{
                margin: 0;
                padding: 0;
                background-color: #CCC;
                }

                @font-face{
                src: url(assets/fonts/oswald-v16-latin-regular.ttf);
                font-family: oswald;
                }

                /* ~~ The header is given a width of 100%.
                It will extend the full width of the browser.
                The rest of the layout will be fixed~~ */
                header{
                background-color: #004489;
                min-width: 1024px;
                height: 100px;
                clear: both;
                }
                /*header::after {
                content: '';
                display: block;
                clear: both;
                }*/
                .navWrapper{
                max-width: 1100px;
                margin: 0 auto;
                }

                nav{
                float:right;
                margin-top: 20px;
                padding-right: 50px;
                }

                nav ul{
                list-style: none;
                padding: 0;
                margin: 0;

                }

                nav ul li{
                display: inline-block;
                float: left;
                position: relative;

                }

                nav ul li a{
                display: block;
                margin: 0;
                padding: 10px 10px;
                text-decoration: none;
                font-family: oswald;
                font-size: 25px;
                color: #fff;
                }


                nav ul a:hover, nav ul a:active, nav ul a:focus{
                background-color: #065BB0;
                }

                nav ul ul{
                display: none;/**/
                position: absolute;
                }

                /* Display Dropdowns on Hover */

                nav ul ul li{
                display: block;
                width: 115px;
                box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
                }
                nav ul ul li a{
                color:#242323;
                background-color: #8ec6ef;

                }
                nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
                color:#fff;
                background-color: #065BB0;
                }

                <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
                <body>
                <header>
                <div class="navWrapper">
                <nav>
                <ul>
                <li><a href="#">HOME</a></li>
                <li id="bga-list"><a href="#">BGA</a>
                <ul>
                <li><a href="#">BOOKS</a></li>
                <li><a href="#">COURSES</a></li>
                </ul>
                </li>
                <li><a href="#">CONTACT</a></li>
                </ul>
                </nav>
                </div>
                </header>
                </body>





                $('#bga-list').mouseenter(() => {
                $('#bga-list > ul').show();
                })

                @charset "utf-8";
                /* CSS Document */
                body{
                margin: 0;
                padding: 0;
                background-color: #CCC;
                }

                @font-face{
                src: url(assets/fonts/oswald-v16-latin-regular.ttf);
                font-family: oswald;
                }

                /* ~~ The header is given a width of 100%.
                It will extend the full width of the browser.
                The rest of the layout will be fixed~~ */
                header{
                background-color: #004489;
                min-width: 1024px;
                height: 100px;
                clear: both;
                }
                /*header::after {
                content: '';
                display: block;
                clear: both;
                }*/
                .navWrapper{
                max-width: 1100px;
                margin: 0 auto;
                }

                nav{
                float:right;
                margin-top: 20px;
                padding-right: 50px;
                }

                nav ul{
                list-style: none;
                padding: 0;
                margin: 0;

                }

                nav ul li{
                display: inline-block;
                float: left;
                position: relative;

                }

                nav ul li a{
                display: block;
                margin: 0;
                padding: 10px 10px;
                text-decoration: none;
                font-family: oswald;
                font-size: 25px;
                color: #fff;
                }


                nav ul a:hover, nav ul a:active, nav ul a:focus{
                background-color: #065BB0;
                }

                nav ul ul{
                display: none;/**/
                position: absolute;
                }

                /* Display Dropdowns on Hover */

                nav ul ul li{
                display: block;
                width: 115px;
                box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
                }
                nav ul ul li a{
                color:#242323;
                background-color: #8ec6ef;

                }
                nav ul ul a:hover, nav ul ul a:active, nav ul ul a:focus{
                color:#fff;
                background-color: #065BB0;
                }

                <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
                <body>
                <header>
                <div class="navWrapper">
                <nav>
                <ul>
                <li><a href="#">HOME</a></li>
                <li id="bga-list"><a href="#">BGA</a>
                <ul>
                <li><a href="#">BOOKS</a></li>
                <li><a href="#">COURSES</a></li>
                </ul>
                </li>
                <li><a href="#">CONTACT</a></li>
                </ul>
                </nav>
                </div>
                </header>
                </body>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 17 '18 at 3:23

























                answered Nov 17 '18 at 3:10









                Hai PhamHai Pham

                1,293216




                1,293216
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345960%2fnavigation-drop-down-menu-css%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Xamarin.iOS Cant Deploy on Iphone

                    Glorious Revolution

                    Dulmage-Mendelsohn matrix decomposition in Python