All TalkersCode Topics

Follow TalkersCode On Social Media

Image Zoom In On Hover Using CSS3

Last Updated : Apr 15, 2022

IN - CSS3 HTML

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.

Latest Tutorials