Open In App
Related Articles

How to Create Image Hovered Detail using HTML & CSS ?

Improve Article
Save Article
Like Article

In this article, we will learn how to create a type of hover effect over an image to get its complete detail. This is can be achieved by using simple HTML & CSS.

Overview Of Our Project:


  • We will first create an HTML file in which we are going to add an image for our image hanger.
  • We will then create a CSS style to give animation effects to the element containing the image.

We will start by defining the HTML and CSS sections of the page as given below.

HTML Section: In this section, the structure of the page is defined.

  • We will first create an HTML file.
  • We are then going to write out the boilerplate code required for an HTML page.
  • We will next link the CSS file or directly add the required CSS that provides all the animation effects.
  • In the body section, we will add an image source so that we can display our image.


<!DOCTYPE html>
<html lang="en">
    <link rel="stylesheet" href="style.css">
    <h1>hover over gfg logo --)</h1>
    <div class="main_box">
        <div class="circle"></div>
        <div class="content">
                A Computer Science portal for geeks.
                It contains well written,
                well thought and well explained
                computer science and programming
                articles, quizzes and much more..
            <a href="#">Contact Us</a>
        <img src=

CSS Section: In this section, we will define the CSS of the page. Using CSS we will give different types of animations and effects
 to our HTML page so that it looks interactive to all users. 

  • We will first reset all the browser effects so that everything is consistent on all browsers.
  • Then we will define the styling to be given to the elements which include the size and position.
  • We will use clip-path function to give specific shapes to our objects.


    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: #000;
    background-color: rgb(71, 69, 69);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    width: 42em;
    height: 25em;
    display: flex;
    align-items: center;
    border-radius: 1.5em;
    transition: .5s;
.main_box .circle{
    position: absolute;
    top: 6%;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 1.5em;
    overflow: hidden;
.main_box .circle::before{
    content: '';
    position: absolute;
    top: 0%;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: circle(7.5em at center);
    transition: .4s;
    margin-right: 1em ;
.main_box:hover .circle::before{
    clip-path: circle(30em at center);
    background: rgb(20, 220, 43);
.main_box img{
    top: 50%;
    left: 50%;
    height: 5.75em;
    transform: translate(-50%,-50%);
    position: absolute;
    pointer-events: none;
    transition: 0.4s;
.main_box:hover img{
    left: 80%;
    top: 12.25em;
    height: 10em;
.main_box .content{
    position: relative;
    width: 50%;
    background: rgb(20, 220, 43);
    padding: 1.25em 1.25em 1.25em 2.5em;
    transition: .5s;
    opacity: 0;
    visibility: hidden;
.main_box:hover .content{
    left: 10%;
    opacity: 1;
    visibility: visible;
.main_box .content h2{
    text-transform: uppercase;
    font-size: 2em;
    line-height: 1em;
.main_box .content p{
    color: #fff;
.main_box .content a{
    position: relative;
    text-decoration: none;
    color: rgb(186, 14, 14);
    padding: .6em 1.25em;
    margin-top: 0.6em;
    display: inline-block;


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 12 May, 2021
Like Article
Save Article
Similar Reads
Related Tutorials