ummmm... | Sololearn: Learn to code for FREE!
+ 1


How can you make it so in CSS that if you hover over one element, then another element will change?

13th Jun 2024, 6:07 AM
Wolf Cub
Wolf Cub - avatar
4 Answers
+ 2
you can influence the element if it's a next sibling <style> p:hover + h1{ color:red; font-size:4rem; transform: translate(20px,-100px) rotate(-30deg); transition:.5s; } </style> <p>hover me</p> <h1>wow</h1> but you will have to use javascript or jquery if you want to control unrelated elements...
13th Jun 2024, 12:19 PM
Bob_Li - avatar
use the pseudo selector :hover for instance: a { } a:hover { } img { } img:hover { } I hope this helps
13th Jun 2024, 6:48 AM
Mihaly Nyilas
Mihaly Nyilas - avatar
I know this, I just have a question: is it possible to make it so that when you hover over one element, the other changes?
13th Jun 2024, 7:37 AM
Wolf Cub
Wolf Cub - avatar