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>
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 have this style of the un
class fired when I hover on the parent element just by using CSS?
The way I did it works when I hover over <a>
, however for layout reasons I would like the effect to be triggered when I hover over the parent element.
Below is the result that I have at the moment: