“Comment changer un autre élément sur planant” Réponses codées

Comment changer un autre élément sur planant

// If the cube is directly inside the container:
#container:hover > #cube { background-color: yellow; }

// If cube is next to (after containers closing tag) the container:
#container:hover + #cube { background-color: yellow; }

// If the cube is somewhere inside the container:
#container:hover #cube { background-color: yellow; }

// If the cube is a sibling of the container:
#container:hover ~ #cube { background-color: yellow; }
Rohan

CSS Hover change un autre élément

#a:hover ~ #b {
    background: #ccc
}

<div id="a">Div A</div>
<div>random other elements</div>
<div>random other elements</div>
<div>random other elements</div>
<div id="b">Div B</div>
Modern Mouse

CSS Hover change un autre élément

#container:hover > #cube { background-color: yellow; }
Elated Elephant

CSS Hover change un autre élément

#a:hover + #b {
    background: #ccc
}

<div id="a">Div A</div>
<div id="b">Div B</div>
Modern Mouse

Réponses similaires à “Comment changer un autre élément sur planant”

Questions similaires à “Comment changer un autre élément sur planant”

Plus de réponses similaires à “Comment changer un autre élément sur planant” dans CSS

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code