Hover on a content change its container background | SoloLearn: Learn to code for FREE!

+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

10/31/2019 9:16:11 PM

Med Amine Fh

3 Answers

New Answer

+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.👍

+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

+1

Oh! Makes sense! Let me do some research real quick!