Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a dropdownmenu without a list in CSS

I want to make a dropdown menu with CSS. I know a little bit how to make it but the HTML structure is different.
My structure is like that:

enter image description here

So in the end I would like to have it work like that:
-When you hover over menu1, the first submenupanel should dropdown with its submenulink.

the CSS of submenu_panel is looking like that:

   .submenu_panel {
    width: 100%;
    height: 100%;
    background: gray;
    height:0px;
    overflow: hidden;
    transition: all 0.2s ease-in-out;
}

Can anyone help me to make my dropdown menu?

This is a short version of it in jsfiddle https://jsfiddle.net/4bjk8opa/

like image 451
aha364636 Avatar asked Feb 24 '26 09:02

aha364636


1 Answers

Will this work with you.

Fiddle

 ul > li {display: block; float: left; margin-right: 10px; position: relative; background: Red; padding: 0.5em; line-height: 1em}
ul ul {display: none; width: 150px; position:absolute; top: 2em; left: 0}
ul ul > li {float: none;}
ul > li:hover > ul,
ul > a:hover + ul {display: block}
like image 155
Steevan Avatar answered Feb 26 '26 22:02

Steevan