raulbaros raulbaros - 4 months ago 14
CSS Question

Hover effect for only selected child's

I know that when I want to apply a hover effect to ALL divs inside a well I can use this code:

.well:hover div {

But now I want to apply the hover effect only to divs I wish inside this well. How can I specify them? I tried something like this:

.well:hover div1,div2,div9 {}

but that doesnt seem right. How to do it?

pol pol

When using comma, each entry is a separate selector:

So you should do it like this: .well:hover div1, .well:hover div2, .well:hover div9 { /* your styles here */ }

Unless you are using a preprocessor, this can't be shortened.