RedNaxel
RedNaxel

Reputation: 452

Target tag inside parent on hover

I have a parent element:

.product-container

Then, inside it, I have a <p> element, which is styled in css via:

.product-container p 

Now, I need to apply some style to this <p>, when .product-container is hovered. But this does not work:

.product-container:hover .product-container p

So, is there a way to target this <p> on parent hover via css, without applying class or id to the <p>?

Upvotes: 2

Views: 60

Answers (1)

Akshay
Akshay

Reputation: 14378

Try

.product-container:hover p

instead of

.product-container:hover .product-container p

Upvotes: 4

Related Questions