how can i create a div (in html) to hover state that changes its entire content on hover? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how can i create a div (in html) to hover state that changes its entire content on hover?

I have a div tag and some <h1> & <p> text inside of it. Now i would like to change the colors of each of those texts respectively into different colors individually, when the cursor hovers over the div (any part of the div; let the div be a container of 500x500PX) ! how can i achieve this? thank you.

23rd Aug 2017, 10:44 AM
PAR2
PAR2 - avatar
2 Answers
+ 2
.container p, .container h1 { display: inline-block; width: 500px; height: 500px; color: black; } .container:hover h1 { color: red; } .container:hover p { color: green; }
23rd Aug 2017, 12:32 PM
Calviղ
Calviղ - avatar
23rd Oct 2017, 3:43 PM
Elizabeth🌸
Elizabeth🌸 - avatar