Skip to main content
Removed irrelevant markup and styling, improved formatting
Source Link
Zhihao
  • 14.7k
  • 2
  • 29
  • 36

I would like to share my simplified Answer for the Question "How to change image on hover". HereHere is thea simplified code sample:

<!DOCTYPE HTML> <html> <head> <title>Change Image on hover example</title> .change_img <style>{   .change_img{ background-image: url(image1.jpg); width:500px; height:500px;   }  .change_img:hover {  background-image: url(image2.jpg); }  </style> </head> <body> <div class="change_img">Sample</div> </body> </html>} 

I would like to share my simplified Answer for the Question "How to change image on hover". Here is the code sample:

<!DOCTYPE HTML> <html> <head> <title>Change Image on hover example</title>  <style>   .change_img{ background-image:url(image1.jpg); width:500px; height:500px; }  .change_img:hover { background-image:url(image2.jpg); }  </style> </head> <body> <div class="change_img">Sample</div> </body> </html> 

Here is a simplified code sample:

.change_img { background-image: url(image1.jpg);  } .change_img:hover {  background-image: url(image2.jpg); } 
Source Link

I would like to share my simplified Answer for the Question "How to change image on hover". Here is the code sample:

<!DOCTYPE HTML> <html> <head> <title>Change Image on hover example</title> <style> .change_img{ background-image:url(image1.jpg); width:500px; height:500px; } .change_img:hover { background-image:url(image2.jpg); } </style> </head> <body> <div class="change_img">Sample</div> </body> </html>