1
The submenu is the size of the text, I would like it to be the size of the menu
header {
position: fixed;
top: 0;
left: 0;
right: 0;
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);
}
header > nav {
position: relative;
}
header nav * {
display: flex;
flex: 1 1 auto;
}
header > nav ul {
padding: 0;
margin: 0;
}
header > nav ul li {
list-style: none;
line-height: 50px;
}
header > nav > ul > li {
flex-direction: column;
text-align: center;
}
header > nav > ul > li[ng-click]:hover {
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);
}
header > nav > ul > li > ul {
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);
position: absolute;
flex-direction: column;
flex-grow: 1;
}
header > nav > ul > li > ul > li {
background-color: rgba(255, 255, 255, 1);
padding-left: 15px;
display: none;
}
header > nav > ul > li:hover > ul > li {
display: flex;
}
<header><nav>
<ul>
<li>Home</li>
<li>Usuários
<ul>
<li>Conectar</li>
<li>Cadastrar</li>
<li>Meu perfil</li>
</ul>
</li>
<li>UFEF</li>
</ul>
</nav></header>
It works, but you know how I can do it with flex instead of width?
– Costamilam
Man, I only know with
width
same. See a similar menu tb uses width in flexbox: https://codepen.io/barkins/pen/KzrKrj– Sam
Yes, I updated the response with the effect.
– Sam
I added an opacity effect to make it even smoother :D
– Sam
Stay top worth!
– Costamilam