I'm studying about hover , onMouseOver and onMouseOut . Suppose in this situation I want to change the background of an image when I pass the mouse on it.
What is the correct way to program? Is using CSS (: hover ) or through JavaScript (onMouseOver and onMouseOut)? Why?
<div id="img1">
<img src="https://vignette.wikia.nocookie.net/unmario/images/a/ad/300px-Nsmb-mushroom-super.jpg/revision/latest?cb=20081217191119"></div><divid="img2">
<img src="https://vignette.wikia.nocookie.net/unmario/images/a/ad/300px-Nsmb-mushroom-super.jpg/revision/latest?cb=20081217191119">
</div>