I want to change the background color of an image inside a div whenever i hover any point of the div.
something like:
.divskins{
background-color: #13191c;
width: 240px;
height: 300px;
}
.divskins img{
width: 240px;
height: 240px;
margin: 0;
background-color: #4c0907;
}
.divskins:hover{
img > background-color: #8e180c;
}
i tried to use img > background-color: #8e180c;
but of course didn’t work
2
Answers
I hope it’s not the answer, but you need to read CSS documentation. You need to use:
But why changing the background-color of an image ? I don’t understand
You need to add :hover pseudo-class for the parent divskins and then apply the background color change to the child img