// 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; }
#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>
#container:hover ~ #cube { background-color: yellow; }
#container:hover > #cube { background-color: yellow; }
#a:hover + #b {
background: #ccc
}
<div id="a">Div A</div>
<div id="b">Div B</div>
.hover {
background-color: blue;
padding: 8px;
}
.move {
background-color: red;
padding: 8px;
transition: 0.5s;
}
.hover:hover ~ .move {
margin-top: 48px;
}
Code Example |
---|
Css :: why is my body background color in css not working |
Css :: horizontal scroll bar |
Css :: hex values |
Css :: circle progress bar css |
Css :: advance css |
Css :: css elementos |
Css :: box shadow css transition |
Css :: selectors combinators css |
Css :: what is bulletproof buttons |
Css :: css3 app basic |
Css :: line height negative css |
Css :: Reference WP media file on child theme CSS file |
Css :: convert css in scss |
Css :: combine text styles |
Css :: html css form validation |
Css :: Accordion example |
Css :: step 54 freecodecamp rwd |
Css :: fix materialize form label not working |
Css :: Creating Intrinsic Ratios |
Css :: screen only in css |
Css :: font-family: robort; |
Css :: get clicked position javascript image |
Css :: flex box divs squeeze together |
Css :: como dibujar un cuadro en css |
Css :: sass @use |
Css :: div nth child |
Css :: CSS Print a Sass @debug message |
Css :: css video poster object-fit |
Css :: css different rules on different devices |
Css :: css linear-gradient angle |