¿Cómo se puede crear una barra de navegación vertical con menús desplegables?

Tengo una barra de navegación vertical. Ahora, se supone que esta barra de navegación tiene menús desplegables. El único problema para mí es que no puedo hacer que los menús desplegables estén al costado del menú. Tengo el HTML and CSS en jsFiddle aquí: http://jsfiddle.net/maxkoenig/ZYUeX/ Aquí está si no quieres ir al sitio web: HTML:

  

CSS:

 #wrap { width: 150px; height: 50px; padding-bottom: 10px; margin: 0; /* Ensures there is no space between sides of the screen and the menu */ z-index: 1; /* Makes sure that your menu remains on top of other page elements */ position: fixed; background-color: RoyalBlue; } .navbar { height: 50px; padding: 0; padding-bottom: 10px; margin: 0; position: fixed; /* Ensures that the menu doesn't affect other elements */ border-right: 1px solid #54879d; z-index: 12; } .navbar li { padding-bottom: 10px; height: auto; width: 150px; /* Each menu item is 150px wide */ /*float: left; This lines up the menu items horizontally */ object-position: top; text-align: center; /* All text is placed in the center of the box */ list-style: none; /* Removes the default styling (bullets) for the list */ font: normal bold 12px/1.2em Arial, Verdana, Helvetica; padding: 0; margin: 0; background-color: RoyalBlue; } .navbar a { padding: 18px 0; /* Adds a padding on the top and bottom so the text appears centered vertically */ border-left: 1px solid #0026ff; /* Creates a border in a slightly lighter shade of blue than the background. Combined with the right border, this creates a nice effect. */ border-right: 1px solid #0026ff; /* Creates a border in a slightly darker shade of blue than the background. Combined with the left border, this creates a nice effect. */ text-decoration: none; /* Removes the default hyperlink styling. */ color: #000; /* Text color is black */ display: block; } .navbar li:hover, a:hover { background-color: rgba(4, 6, 0, 0.00); } .navbar li ul { display: none; /* Hides the drop-down menu */ height: auto; margin: 0; /* Aligns drop-down box underneath the menu item */ padding: 0; /* Aligns drop-down box underneath the menu item */ } .navbar li:hover ul { display: block; /* Displays the drop-down box when the menu item is hovered over */ z-index: 12; padding-left: 1px; } .navbar li ul li { background-color: #2ba6ff; } .navbar li ul li a { border-left: 1px solid #0026ff; border-right: 1px solid #0026ff; border-top: 1px solid #0026ff; z-index: 1001; } .navbar li ul li a:hover { background-color: #0094ff; z-index: 1000; } 

Hacer esto:

 .navbar li ul { display: none; /* Hides the drop-down menu */ margin-left: 150px; margin-top: -50px; float:left; height: 0; } 

Aquí está la demostración de jsFiddle: http://jsfiddle.net/leniel/ZYUeX/3/

    Intereting Posts