raulbaros raulbaros - 4 years ago 170
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
Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download