Related Articles

Related Articles

How to zoom an element on Hover using CSS ?
  • Last Updated : 27 Apr, 2020

In this article, we learn about how to zoom on hover using CSS. It is called pseudo-selector and used to select all the elements when the user moves the mouse over the elements. When the user hovering on the element the scale function is called to increase the dimensions of the element. It can be used on all the elements. An element must be declared in the document to see the working of this selector in all the elements.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to zoom an element
        on Hover using CSS ?
    </title>
    <meta name="viewport" content=
        "width=device-width, initial-scale=1">
  
    <style>
        * {
            box-sizing: border-box;
        }
  
        .sudo {
  
            padding: 50px;
            background-color: red;
            transition: transform .2s;
            width: 160px;
            height: 160px;
            margin: 0 auto;
            border-radius: 29px;
        }
  
        .sudo:hover {
            -ms-transform: scale(4.6);
            /* IE 9 */
            -webkit-transform: scale(1.5);
            /* Safari 3-8 */
            transform: scale(1.5);
        }
    </style>
</head>
  
<body>
    <center>
        <h1>
            GeeksForGeek
        </h1>
  
        <h2>
            How TO – Zoom on Hover
            in inline CSS
        </h2>
  
        <div class="sudo">
            Hover on Me
        </div>
    </center>
</body>
  
</html>

chevron_right


Output:

  • Before Hovering on Red-Box:
  • After Hovering on Red-Box:

Supported Browsers: The supported browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

full-stack-img




My Personal Notes arrow_drop_up
Recommended Articles
Page :