Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to define multiple classes' hover event in css?

Tags:

html

css

In css how can I define multiple class' hover events to use the same properties. This doesn't seem to work:

.my_div:hover .my_td:hover {     border: 1px solid red; } 

Thanks

like image 563
omega Avatar asked Aug 26 '12 18:08

omega


People also ask

Can I hover a class on CSS?

The :hover CSS pseudo-class matches when the user interacts with an element with a pointing device, but does not necessarily activate it. It is generally triggered when the user hovers over an element with the cursor (mouse pointer).

Can an attribute have multiple classes?

HTML elements can be assigned multiple classes by listing the classes in the class attribute, with a blank space to separate them.

Can you make a div hover?

To display div element using CSS on hover a tag: First, set the div element invisible i.e display:none;. By using the adjacent sibling selector and hover on a tag to display the div element.


1 Answers

You should separate with a comma, like this:

.my_div:hover, .my_td:hover {       border: 1px solid red; } .contact-dpd:hover .contact-content, .work-dpd:hover .work-content{      display:block } 
like image 171
mewm Avatar answered Sep 19 '22 13:09

mewm