Having trouble with the dropdown menu as its not appearing on hovering (just a html-css template)

drop down navigation menu html
dropdown menu html
menu and submenu in html examples
responsive drop down menu with submenu
drop down menu in html on mouseover
dropdown content not showing
vertical dropdown menu
horizontal drop down menu css

I'm having trouble writing a code for a simple drop down menu but cant understand what I'm doing wrong still new to coding. Whenever I bring my cursor over the respective dropdown li tag the hover color effect is there but nothing comes down. In a previous attempt when the code was a a little different the list id appeared but it was in an inline manner and was align horizontally not vertically plz help.

#navbar {
  background-color: #9C9C9C;
  margin: 0px 200px 0px 200px;
  height: 30px;
  overflow: hidden;
}

#nav {
  padding: 0px;
  margin: 0px;
  font-family: arial;
}

#main {
  display: inline;
}

a {
  display: block;
  text-align: center;
  float: left;
  width: 100px;
  padding: 3px;
  line-height: 25px;
  text-decoration: none;
  color: white;
  margin-top: 0px;
}

a:hover {
  background-color: #d3d3d3;
  color: black;
}

ul li ul li {
  display: none;
}

ul li:hover ul li {
  display block;
}

#searchbar {
  margin: 5px 5px 0px 0px;
  float: right;
}
<div id="navbar">
  <div>
    <ul id="nav">
      <li id="main"><a href="#">Home</a></li>
      <li id="main"><a href="#">Products</a></li>
      <li id="main"><a href="#">More</a>
        <ul class="c">
          <li class="B"><a id="A">Article1</a></li>
          <li class="B"><a id="A">Article2</a></li>
          <li class="B"><a id="A">Article3</a></li>
          <li class="B"><a id="A">Article4</a></li>
        </ul>
      </li>
      <li id="main"><a href="#">About US</a></li>
    </ul>
  </div>



  <div id="searchbar"><input type="text" name="search" /><button id="button">GO</button></div>
</div>

First of all, you have id="main" applied to multiple elements. id is meant to be unique and applied to only one element.

Second, your hover effect was just a little incomplete. See my changes below.

#navbar {
  background-color: #9C9C9C;
  margin: 0px 200px 0px 200px;
  height: 30px;
  /*overflow: hidden; don't do this if you want dropdowns */
}

#nav {
  padding: 0px;
  margin: 0px;
  font-family: arial;
}

#main {
  display: inline;
}

#nav>li>a {
  display: block;
  text-align: center;
  float: left;
  width: 100px;
  padding: 3px;
  line-height: 25px;
  text-decoration: none;
  color: white;
  margin-top: 0px;
}

#nav>li>a:hover {
  background-color: #d3d3d3;
  color: black;
}

#nav>li {
  position: relative;
  display: inline-block;
}

#nav>li ul {
  display: none;
  position: absolute;
}

#nav>li:hover ul {
  display: block;
  bottom: -80px;
  padding: 10px;
  left: 0;
  min-width: 100px;
}

#searchbar {
  margin: 5px 5px 0px 0px;
  float: right;
}
<div id="navbar">
  <div>
    <ul id="nav">
      <li><a href="#">Home</a></li>
      <li><a href="#">Products</a></li>
      <li><a href="#">More</a>
        <ul class="c">
          <li class="B"><a id="A">Article1</a></li>
          <li class="B"><a id="A">Article2</a></li>
          <li class="B"><a id="A">Article3</a></li>
          <li class="B"><a id="A">Article4</a></li>
        </ul>
      </li>
      <li><a href="#">About US</a></li>
    </ul>
  </div>



  <div id="searchbar"><input type="text" name="search" /><button id="button">GO</button></div>
</div>

Dropdown Menu Not showing! - HTML & CSS, Ok having some issues. I've used this code several times for Dropdowns and now the childs are not showing for some reason, I must have did  html & css Linda_A 2011-08-16 22:14:29 UTC #1 I am having problems with a menu triggered on a hover; it doesn't stay open as I mouse down to the actual menu items.


you need to target ul li ul which you will show and hide ... and #main id can not be duplicate on the same page.. working example as below

#navbar {
  background-color: #9C9C9C;
  margin: 0px 200px 0px 200px;
  height: 30px;
  overflow: hidden;
}

#nav {
  padding: 0px;
  margin: 0px;
  font-family: arial;
}

#main {
  display: inline;
}

a {
  display: block;
  text-align: center;
  float: left;
  width: 100px;
  padding: 3px;
  line-height: 25px;
  text-decoration: none;
  color: white;
  margin-top: 0px;
}

a:hover {
  background-color: #d3d3d3;
  color: black;
}
ul li{display: inherit;}
ul li ul {
    display: none;
    width: auto;
    position: absolute;
    top: 35px;
    background: #ccc;
    margin: 0;
    padding: 0;
}

ul li ul li{display:block; list-style-type:none}
ul li:hover ul {
  display: block;
  z-index:1000;
  
}

#searchbar {
  margin: 5px 5px 0px 0px;
  float: right;
}
<div id="navbar">
  <div>
    <ul id="nav">
      <li class="nestedchild"><a href="#">More</a>
        <ul class="c">
          <li class="B"><a id="A">Article1</a></li>
          <li class="B"><a id="A">Article2</a></li>
          <li class="B"><a id="A">Article3</a></li>
          <li class="B"><a id="A">Article4</a></li>
        </ul>
      </li>
      <li id="main"><a href="#">About US</a></li>
    </ul>
  </div>



  <div id="searchbar"><input type="text" name="search" /><button id="button">GO</button></div>
</div>

How To Create a Hoverable Dropdown Menu, We also use z-index to place the dropdown in front of other elements. The :hover selector is used to show the dropdown menu when the user moves the mouse  The slight danger is that you can cover up a decent amount of adjacent menu items, which could mean a user hovering over a legit menu item and not being able to click it. I imagine in a lot of cases they just move the mouse a little and it works, but it’s definitely a balancing act between too small and too big.


Your css should be like that.

.first .link {
color: black;
transform: rotate(-90deg);
width: auto;
border-bottom: 2px solid #FFFFFF;
position: relative;
top: 0vh;
}
.first {
background: green;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
 }

.menu {
  background-color:red; 
 }

.bottom-line {
  border-bottom:5px solid pink; 
 }



 #navbar{

background-color: #9C9C9C;
margin: 0 auto;
padding: 30px 0;
width: 1200px;


}
#nav{
padding: 0px;
margin: 0px;
font-family: arial;
float: left;
list-style: none;
}
 #main{
  display: inline;
 }
 a{
   display: block;
  text-align: center;
  float: left;
  width: 100px;
  padding: 3px;
  line-height: 25px;
  text-decoration: none;
  color: white;
 margin-top: 0px;
  }
  a:hover{
   background-color: #d3d3d3;
   color: black;
   }

  ul li {
  float: left;
  position: relative;
    }   

 ul li ul {
   display: none;
   position: absolute;
   list-style: none;
  top: 32px;
   z-index: 5;
    background-color: #ddd;
  padding-left: 0;
  } 
  ul li:hover ul {
   display: block;
  }

#searchbar {
   margin: 5px 5px 0px 0px;
  float: right;
 }

and You can also see demo here

CSS Dropdowns, HTML) Use any element to open the dropdown content, e.g. a <span>, or a <​button> It is hidden by default, and will be displayed on hover (see below). we have used the CSS box-shadow property to make the dropdown menu look like a "card". The :hover selector is used to show the dropdown menu when the user  The original article mentioned problems in IE6 with not having a background colour, so this *may* create other problems which you’ll have to sort out for yourself! 🙂 You could for example leave the background colour in place but make the highlighting rules !important.


Pro CSS and HTML Design Patterns, You can float the drop-down menu and its title to the left to shrinkwrap the menu This keeps images and text aligned in two columns when there is no image in a hidden class, which determines whether the drop-down menu is visible or not​. functions add or remove the hover class from menu items and the menu title. Click dropdown menu instead of hover using just CSS? I currently have a hover dropdown menu but want it to be clickable. thus while hovering, or while a link


Professional CSS: Cascading Style Sheets for Web Design, Creating. CSS. Drop-Down. Menus. In the dot-com gold rush of the late 1990s, the but behind their glitzy fagade was often a hornet's nest of IavaScript, bloated HTML, early drop—down solutions more often than not added levels of frustration had limited support for the :hover attribute (and CSS in general, but that's  There are hundreds of HTML dropdown hover menu techniques that you can find over the internet. And I am not trying to reinvent the wheel here but trying to come with the most simplest technique to create HTML Hover Menu using just Cascading Style Sheet (CSS). No Javascript is used in this demo and it works great with most of the browsers.


w3-dropdown, Both the hoverable element and the dropdown content element can be any HTML element. In the example above the hover element was a <button>, and the​  HTML & CSS. affinitymm 2011-02-19 the menu and CSS in a test area on my site and I can't get the submenus to appear when hovering over the main menu. When you hover over a title in blue, the