3
I’m editing the blog, and I wanted to do a menu with submenus, but I don’t know exactly what makes it happen. I tried googling, but I got nothing. Only css tutorials appear, but nothing specific that can tell me which css code does that. I want to know exactly what makes a menu stick with a submenu... javascript, css, jquery.. Anything...
I’m using this code, which works great... http://tableless.com.br/header-responsivo-somente-com-css/
Only I want to put a submenu on it. As it is following:
header {
min-height: 60px;
position: fixed;
top: 0;
right: 0;
left: 0;
border-bottom: 1px solid #ccc;
background: #ECECEC;
z-index: 2;
}
header ul {
padding: 15px 10px 0 0;
}
header li {
border-left: 1px solid #ccc;
}
header li:first-child {
border: none;
}
header li a {
display: block;
padding: 0 10px;
color: #999;
font-size: 16px;
line-height: 30px;
text-decoration: none;
-webkit-transition: all 300ms ease;
transition: all 300ms ease;
}
header li a:hover {
color: #333;
}
header > ul > li > ul{
-webkit-transition: all 0.7s ease;
-moz-transition: all 0.7s ease;
-o-transition: all 0.7s ease;
-moz-opacity: 0.00;
opacity: 0.00;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha"(Opacity=0);
}
header > ul > li:hover > ul{
-moz-opacity: 1;
opacity: 1;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha"(Opacity=100);
}
@media screen and (max-width: 767px) {
header .control-nav {
position: absolute;
right: 20px;
top: 20px;
display: block;
width: 30px;
padding: 5px 0;
border: solid #333;
border-width: 3px 0;
z-index: 2;
cursor: pointer;
}
header .control-nav:before {
content: "";
display: block;
height: 3px;
background: #333;
}
header .control-nav-close {
position: fixed;
right: 0;
top: 0;
bottom: 0;
left: 0;
display: block;
z-index: 1;
background: rgba(0, 0, 0, 0.4);
-webkit-transition: all 500ms ease;
transition: all 500ms ease;
-webkit-transform: translate(100%, 0);
-ms-transform: translate(100%, 0);
transform: translate(100%, 0);
}
header nav {
position: fixed;
top: 0;
right: 0;
bottom: 0;
width: 250px;
border-left: 1px solid #ccc;
background: #fff;
overflow-x: auto;
z-index: 2;
-webkit-transition: all 500ms ease;
transition: all 500ms ease;
-webkit-transform: translate(100%, 0);
-ms-transform: translate(100%, 0);
transform: translate(100%, 0);
}
}
#control-nav:checked ~ .control-nav-close {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0, 0);
transform: translate(0, 0);
}
#control-nav:checked ~ nav {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0, 0);
transform: translate(0, 0);
}
<head>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no" />
</head>
<header>
<h1 class="fL">
<a href="#" title="">Teste</a>
</h1>
<nav class="fR">
<ul class="l2">
<li>
<a href="#" title="">Menu</a>
</li>
<li>
<a href="#" title="">Quem sou?</a>
<li>
<a href='#' title=''>Categorias</a>
<ul>
<li><a href='#' title='Sub Produto 1'>Sub Produto 1</a></li>
<li><a href='#' title='Sub Produto 2'>Sub Produto 2</a></li>
<li><a href='#' title='Sub Produto 3'>Sub Produto 3</a></li>
<li><a href='#' title='Sub Produto 1'>Sub Produto 4</a></li>
<li><a href='#' title='Sub Produto 2'>Sub Produto 5</a></li>
<li><a href='#' title='Sub Produto 3'>Sub Produto 6</a></li>
<li><a href='#' title='Sub Produto 1'>Sub Produto 7</a></li>
<li><a href='#' title='Sub Produto 2'>Sub Produto 8</a></li>
<li><a href='#' title='Sub Produto 3'>Sub Produto 9</a></li>
<li><a href='#' title='Sub Produto 1'>Sub Produto 10</a></li>
<li><a href='#' title='Sub Produto 2'>Sub Produto 11</a></li>
<li><a href='#' title='Sub Produto 3'>Sub Produto 12</a></li>
</ul>
</li>
<li>
<a href="#" title="">Contato</a>
</li>
<li>
<a href="#" title="">Anuncie</a>
</li>
</ul>
</nav>
</header>
As I do now so that it only appears when I pass the mouse?
I’m sorry if I didn’t explain it properly!
Behold this link. Teaches in 2 parts how to make a menu as you want. I have implemented this menu in past projects and worked perfectly, just read the instructions carefully.
– user28595
You have a preference for being pure css/html or js?
– celsomtrindade
Thanks @Diegofelipe this link helped me understand what I wanted.
– Carla Vieira
@Celsomtrindade Whatever, I just wanted to understand what made it happen. But I did, thank you!
– Carla Vieira