CSS Menu Vertikal responsive
Hallo zusammen.
Ich habe da ein Menü "zusammengebastelt"
vertical-Menu - JSFiddle
Nun sollten in der responsiv Ansicht alle Menüpunkte (inkl. Submenü) sichtbar sein.
Wie könnte ich das lösen ?
Der hier verwendete Code
<html>
<head>
<meta charset="utf-8">
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Roboto;
font-size: 18px;
line-height: 1.2;
background: #fff;
color: #221204;
}
#hamburger{
position:absolute;
left:-2000px;
display:none;
}
ul {
list-style-type:none;
font-size: 23px;
}
p {
margin: 36px 0;
}
#menu {
overflow: auto;
position:relative;
z-index:3;
}
.submenu {
min-width:160px;
float:left;
}
#menu ul li a{
padding:2px 0px;
background: #00ffff;
display:block;
color:#000;
text-decoration:none;
}
#menu ul li a:hover{
color:#FF4B4B;
}
@media screen and (min-width : 760px){
#menu ul li:hover > ul {
left:160px;
}
}
#menu ul li > ul {
position: absolute;
background: #fff;
top: 0;
min-width: 160px;
left: -160px;
z-index: 1;
font-size: 18px;
}
#menu ul li > ul li a:hover{
background:#fff;
}
@media screen and (max-width : 760px){
body {
font-size: 14px;
}
li {
margin-bottom: 10px;
}
ul li, li a {
width: 100%;
}
#menu ul li ul{
display:inline;
left:0;
position:relative;
}
.mobmenu {
display: inline-block;
cursor: pointer;
margin: 10px;
}
.bar1, .bar2, .bar3 {
width: 35px;
height: 5px;
background-color: #333;
margin: 6px 0;
transition: 0.4s;
}
#hamburger:checked ~ label .bar1 {
transform: rotate(-45deg) translate(-9px, 6px);
}
#hamburger:checked ~ label .bar2 {
opacity: 0;
}
#hamburger:checked ~ label .bar3 {
transform: rotate(45deg) translate(-8px, -8px);
}
.mobmenu ~ nav{
display:none;
}
#hamburger:checked ~ label ~ nav{
display:block;
}
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Vertical Menu</title>
</head>
<body>
<input type="checkbox" id="hamburger">
<label class="mobmenu" for="hamburger">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</label>
<nav id="menu">
<ul class="submenu">
<li><a href="#">Menu-1</a>
<ul>
<li><a href="#">Sub-1.1</a></li>
<li><a href="#">Sub-1.2</a></li>
</ul>
</li>
<li><a href="#">Menu-2</a>
<ul>
<li><a href="#">Sub-2.1</a></li>
<li><a href="#">Sub-2.2</a></li>
<li><a href="#">Sub-2.3</a></li>
<li><a href="#">Sub-2.4</a></li>
<li><a href="#">Sub-2.5</a></li>
</ul></li>
<li><a href="#">Menu-3</a>
<ul>
<li><a href="#">Sub-3.1</a></li>
<li><a href="#">Sub-3.2</a></li>
<li><a href="#">Sub-3.3</a></li>
<li><a href="#">Sub-3.4</a></li>
</ul></li>
<li><a href="#">Menu-4</a>
<ul>
<li><a href="#">Sub-4.1</a></li>
<li><a href="#">Sub-4.2</a></li>
<li><a href="#">Sub-4.3</a></li>
</ul>
</li>
</ul>
</nav>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>
</body>
</html>