1
I’m doing a project where it has 8 Ivs. At first, they all have the white color, but when the mouse is passed on top of each one, the colors change. I would like to make sure that when you hover over the last div, all the previous ones take on their respective colors as if I had Hover in all... It is a very important project!! I thank you in advance!!
code:
/*Cor padrão das divs*/
.cards{
background-color: #fff;
height: 150px;
margin: 10px 5px 5px;
display: inline-table;
transition: .3s;
cursor: pointer;
color:black;
}
/*Cor mudando de cada div com hover*/
.coop:hover{
background-color: yellow;
}
.aceito:hover{
background-color: rgb(166, 255, 34);
}
.tolerancia:hover{
background-color: rgb(22,22,22);
color: white;
}
.dizer:hover{
background-color: #3cc7f2;
}
.pertence:hover{
background-color: #aa0a17;
}
.envolv:hover{
background-color: orange;
}
.solidariedade:hover{
background-color: #ff5252;
}
/*Aqui eu tentei fazer com que a class União (um card/div específico) ao colocar hover, trocasse a cor de todas as divs como se elas estivessem com o mouse hover*/
.uniao:hover ~ .tolerancia{
background-color: rgb(22,22,22);
color: white;
}
.uniao:hover ~ .dizer{
background-color: #3cc7f2;
}
.uniao:hover ~ .pertence{
background-color: #aa0a17;
}
.uniao:hover ~ .envolv{
background-color: orange;
}
.uniao:hover ~ .solidariedade{
background-color: #ff5252;
}
It’s simple to do this with javascript, you’ve tried?
– André Lins
You don’t need js if you can’t use CSS script from
– hugocsl