Tue Aug 16 2022

Flipping Profile Image

CSS3672 views

File Name: flipping-profile-image.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flipping Profile Image</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet"> 
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: 'Poppins', sans-serif;
        }

        body {
            background-color: #292929;
        }

        section {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100vh;
        }

        .profile {
            width: 160px;
            height: 160px;
            background-color: #fff;
            border-radius: 100%;
            border: #c5c5c5 solid 5px;
            perspective: 600px;
        }

        .profile img {
            position: absolute;
            z-index: 50;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: center;
            border-radius: 100%;
            transform-origin: right center;
            transition: 0.5s all ease-in-out;
        }

        .profile:hover img {
            transform: rotateY(180deg);
        }

        .profile .info {
            width: 100%;
            height: 100%;
            position: relative;
            z-index: 1;
            top: 0;
            left: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
            flex-flow: column;
        }

        .profile .info h2 {
            font-size: 22px;
            margin-bottom: 0;
            color: #ff5e00;
        }

        .profile .info p {
            font-size: 15px;
            color: #292929;
        }
        
    </style>
</head>
<body>
    <section>
        <div class="profile">
            <img src="https://cdn.pixabay.com/photo/2015/11/26/00/14/woman-1063100_960_720.jpg" alt="">
            <div class="info">
                <h2>Lucy</h2>
                <p>Full Stack Developer</p>
            </div>
        </div>
    </section>
</body>
</html>

Result Screenshot(s)

Flipping Profile ImageWorking Sample0

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.