2
I have the following code, which is the menu of my application:
<div class="mainmenu-area" data-spy="affix" data-offset-top="100">
<div class="container">
<!--Logo-->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#primary-menu">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand">
<img class="logo" src="">
</a>
</div>
<!--Logo/-->
<nav class="collapse navbar-collapse" id="primary-menu">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="#home-page">Início</a></li>
<li><a href="#service-page">Facilidades</a></li>
<li><a href="#feature-page">Recursos</a></li>
<li><a href="#price-page">Planos</a></li>
<!-- Isto poderá ser utilizado mais adiante <li><a href="#team-page">Team</a></li> -->
<li><a href="#faq-page">FAQ</a></li>
<li><a href="{{route('login')}}" class="login"><span class="un">Área Restrita </span><span class="ti-lock"></span></a></li>
</ul>
</nav>
</div>
</div>
In it I have a <span>
in the last element <li>
to which I applied the following CSS:
.un {
display: inline-block;
}
.un:after {
content: '';
width: 0px;
height: 1px;
display: block;
background: #ffffff;
transition: 400ms;
}
.un:hover:after {
width: 100%;
}
My question is: is there any way I can make this class style un
is fired when I do the Hover in the parent element only using CSS?
The way I did it works when I hover over the <a>
, but for layout reasons I would like the effect to be triggered when I move the mouse over the parent element.
Below is the result I have at the moment:
Which parent element would be?
– Sam
@Sam the
<li>
then you’d have to climb 2 levels right?– Alvaro Alves
Ah yes, I understand now.
– Sam
Alvaro I will take this opportunity to give you a hint, has this screen graffiti program that can give you a hand, is very light (2MB) and works very well, is what I used to make the image of the answer https://www.screentogif.com/? l=pt_br
– hugocsl