All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

Image Zoom In On Hover Using CSS3

Last Updated : Jul 1, 2023

IN - CSS3 HTML | Written & Updated By - Riya

In this tutorial we will show you how to Zoom In And Zoom Out Images On Hover Using CSS3. You may also like Rotate And Flip Images Using CSS3

Image Zoom In On Hover Using CSS3

To Zoom In Image it takes only one step:-

  1. Make a HTML file and define markup and styling

Step 1. Make a HTML file and define markup and styling

We make a HTML file and save it with a name zoomin.html

<html>
<head>
<style>
body
{
  margin:0 auto;
  padding:0;
  text-align:center;
  height:2000px;
  background-color:#0B2161;
}
#wrapper
{
  width:995px;
  padding:0px;
  margin:0px auto;
  font-family:helvetica;
  text-align:center;
}
h1
{
  text-align:center;
  font-size:35px;
  margin-top:60px;
  color:#A9BCF5;
}
h1 p
{
  text-align:center;
  margin:0px;
  font-size:18px;
  text-decoration:underline;
  color:grey;
}

.item 
{
  border: 1px solid silver;
  overflow: hidden;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  padding: 0;
  width:250px;
  height:220px;
  margin-left:370px;
}
.item img 
{
  max-width: 100%;
  -moz-transition: all 0.3s;
  -webkit-transition: all 0.3s;
  transition: all 0.3s;
  width:250px;
  height:220px;
}
.item:hover img 
{
  -moz-transform: scale(1.3);
  -webkit-transform: scale(1.3);
  transform: scale(1.3);
}
</style>
</head>
<body>

<div id="wrapper">

<div class="item">
  <img src="images/product3.jpg" alt="Demo Zoom In Image On Hover">
</div>

</div>
</body>
</html>

In this step we simply use CSS3 transform property to zoom in the image and we also use CSS3 transition to make zoom in smoother. You may also like Blur And Change Image Color Using CSS3

Thats all, this is how to Zoom In and Out Image On Hover. You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.

I hope this tutorial on zoom image on hover helps you and the steps and method mentioned above are easy to follow and implement.

Author Image About Riya

A recent graduate with a Bachelor of Technology (B.Tech) in Computer Science from India. She is passionate about leveraging technology to solve real-world problems. With a strong foundation and experience in programming languages such as Python, Django, HTML, CSS, and JavaScript, java, php and have honed her skills through hands-on projects and coursework.

Follow Riya On Linkedin 🡪