Less css &: hover

How can I create this class with less?

.class { display: none; } a:hover .class { display: block; } 
+7
source share
3 answers

Like this?

 .class { display: none; a:hover & { display: block; } } 
+10
source
 .class { display: none; &:hover { display: block; } } 
+7
source

I assume from your given CSS that your HTML structure looks like this:

 <a> <div class="class">Content</div> </a> 

You will be happy to learn that what you want to achieve is quite simple using Less; here is the code below:

 a { &:hover { .class { //Apply styling here } } } 

Hope this helps.

+1
source

All Articles