+ 2

Hover on a content change its container background

for exp : <div class="container"> <a href="#" class="content">a link</a> </div> ............... quest : i want to change the background of the container only when i hover the content !? and thank you

31st Oct 2019, 9:16 PM
Med Amine Fh
Med Amine Fh - avatar
3 Answers
+ 1
Here you go, med amine fh ! css example: #container { background-color: #FFF; } #container:hover { background-color: #000; } Use the action-attribute with a colon when you want to target a specific action in CSS.đź‘Ť
31st Oct 2019, 10:36 PM
Brock Miller
Brock Miller - avatar
+ 1
thank's for the try but u don't understand my Q and what i want to do is this .. .content:hover .container{ background-color:#FFF; color :#000; } so when i hover on the link(a) its container change bg color to white and the link color to black ! hope u get what i mean
31st Oct 2019, 10:44 PM
Med Amine Fh
Med Amine Fh - avatar
+ 1
Oh! Makes sense! Let me do some research real quick!
31st Oct 2019, 10:45 PM
Brock Miller
Brock Miller - avatar