How to zoom/scale an element on hover with CSS?

CSSWeb DevelopmentFront End Technology

To zoom/scale an element on hover with CSS, the code is as follows −


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1" />
   * {
      box-sizing: border-box;
   .zoomDiv {
      padding: 50px;
      background-color: yellow;
      transition: transform 0.2s;
      width: 200px;
      height: 200px;
      margin: 70px;
      border-radius: 50%;
      border: 4px solid rgb(78, 37, 155);
   .zoomDiv:hover {
      transform: scale(1.5);
<h1>Zoom on Hover Example</h1>
<h2>Hover over the below element to see it zoom.</h2>
<div class="zoomDiv"></div>


The above code will produce the following output −

On hovering over the yellow circle −

Updated on 08-May-2020 14:01:20