Muazzam Ali Khan Muazzam Ali Khan - 1 month ago 5
CSS Question

How can I apply css properties on more then two html elements when it hover in any of the box

How can I apply css properties on more then two html elements when it hover in any of the box and the properties of both elements can change.

.tab-sec:hover{
background-color:#1b9927;
border: 1px solid #4e4e4e;
color: #000;
h5{
color: #fff;
}
}


I have tried this way but it is not working.

Answer

You can only nest styles with CSS preprocessors like LESS and SASS.

I think to get what you are after you just need to write your style like this:

.tab-sec:hover{
    background-color:#1b9927;
    border: 1px solid #4e4e4e;
    color: #000;
}

.tab-sec:hover h5{
    color: #fff;
}