I am so befuddled. I am trying do something seemingly so simple but failing miserably. I’d like to have the image “b.png” change to “c.png.” Can you find where I went wrong?
index.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="main">
<img src="b.png" />
</div>
</body>
</html>
style.css
.main:hover {
background-image: url('c.png');
}
Your
<div class="main">is gettingc.pngas its background – you just can’t see it behind the<img src="b.png">element.Try removing that
<img>tag, and using this for your CSS:You probably also need to give
.maina height and width, since it no longer has anything inside it to give it a size.