COCA COLA Ads Reveal Effects on Hover HTML CSS @rayen-code

HTML Code

<!-- -------------------- HTML -------------------- -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Coca Cola Card Design</title>

    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <div class="cercle">
            
        </div>
        <div class="textarea">
            <h2>Coca Cola</h2>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita obcaecati a possimus aperiam, aspernatur eaque.</p>
            <a href="#">Buy Now</a>
        </div>
        <img src="img.png" alt="">
    </div>
</body>
</html>

CSS Code

/*-------------------- CSS --------------------*/
*{
    margin: 0;
    padding: 0;
    box-sizing:border-box;
    font-family: sans-serif;
}
body{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.container{
    position: relative;
    width: 180px;
    height: 350px;
    border-radius: 20px;
    /* background: gray; */
    display: flex;
    align-items: center;
    transition: 0.1s;
}
.container:Hover{
    width: 600px;
}
.container .cercle{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.container .cercle::before{
    content: "";
    position: absolute;
    width: 150px;
    aspect-ratio: 1;
    background: red;
    border-radius: 50%;
    transition: 0.5s;

}
.container:hover .cercle::before{
    background: blue;
    width: 130%;
}
.container img{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: 0.5s;
    height: 350px;

}
.container:hover img{
    left: 75%;
    height: 500px;
}
.container .textarea{
    position: relative;
    width: 50%;
    max-height: 250px;
    min-width: 250px;
    left: 10%;
    transition: 0.2s;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
}
.container:hover .textarea{
    left: 0;
    opacity: 1;
    visibility: visible;
}
.container .textarea h2{
    color: white;
    font-size: 2.5rem;
}
.container .textarea p{
    color: white;
    font-size: 0.8rem;
}
.container .textarea a{
    text-decoration: none;
    position: relative;
    padding: 10px 20px;
    color: black;
    background: white;
    border-radius: 8px;
    font-weight: 800;
    display: inline;
    top: 40px;
    transition: 0.5s;
}
.container .textarea a:hover{
    background: gainsboro;
}

0 Comments