Answer the question
In order to leave comments, you need to log in
Why doesn't the first :hover work in less?
Hello, the problem is that &_wrapper:hover doesn't work for some reason. Well, at least crack, I can’t understand why ... Oddly enough, the &_link: hover following it works properly. Please tell me what could be the problem. Thanks in advance for your reply.
Less
.nav-block{
margin: 0;
padding: 0;
float: right;
list-style: none;
&_wrapper{
display: inline-block;
height: 114px;
&_wrapper:hover{
border: 4px solid #b86365;
}
&_link{
text-decoration: none;
color: #666;
padding:0 16px 0 16px;
border-right: 1px solid #666;
line-height: 114px;
text-align: center;
}
&_link:hover{
color: #fff;
}
}
}
<ul class="nav-block">
<li class="nav-block_wrapper"><a href="#" class="nav-block_wrapper_link">HOME</a></li>
<li class="nav-block_wrapper"><a href="#" class="nav-block_wrapper_link">STYLE DEMO</a></li>
<li class="nav-block_wrapper"><a href="#" class="nav-block_wrapper_link">FULL WIDTH</a></li>
<li class="nav-block_wrapper"><a href="#" class="nav-block_wrapper_link">DROPDOWN</a></li>
<li class="nav-block_wrapper"><a href="#" class="nav-block_wrapper_link">GALLERY</a></li>
</ul>
Answer the question
In order to leave comments, you need to log in
If I understand correctly what you are trying to achieve, then you need to fix LESS like this:
&_wrapper {
display: inline-block;
height: 114px;
&:hover {
border: 4px solid #b86365;
}
}
&
is the full path of the parent. Therefore, :hover
there is no need to duplicate for _wrapper
(it is already nested). To be honest, I'm not familiar with LESS. But, as far as I can see from the code, there is nesting. Does it need to be replaced
&_wrapper{
display: inline-block;
height: 114px;
&_wrapper:hover{
border: 4px solid #b86365;
}
&_wrapper{
display: inline-block;
height: 114px;
}
&_wrapper:hover{
border: 4px solid #b86365;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question