Answers for "css affect other elements on hover"

CSS
7

when hover target diffrent element

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

//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; }
Posted by: Guest on July-19-2020
1

make action on hover on other element

#container:hover ~ #cube { background-color: yellow; }
Posted by: Guest on January-17-2021
1

make action on hover on other element

#container:hover #cube {
    background-color: yellow;   
}
Posted by: Guest on January-17-2021
1

css affect other elements on hover

#container:hover ~ #cube { background-color: yellow; }
Posted by: Guest on April-15-2020
0

make action on hover on other element

#container {
  width: 200px;
  height: 30px;
  border: 1px solid var(--c);
  --c:red;
}
#container:hover {
  --c:blue;
}
#container > div {
  width: 30px;
  height: 100%;
  background-color: var(--c);
}
Posted by: Guest on January-17-2021

Browse Popular Code Answers by Language