Skip to content

CSS Hover Effect


HTML CODE

<!DOCTYPE html>
<html>
<head>
    <title>page</title>
     <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="hover-effect1.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">
</head>
<body>
    
    <div id="main">
        <div id="d1"></div>
        <div id="d2"></div>
        <div id="d3"></div>
        <div id="d4"></div>
    </div>
    <div class="content">CODE<br>BLOGGER</div>

</body>
</html>

CSS CODE:

body{
    padding: 0;
    margin: 0;
    background-color: #2f2f2f;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}
#main{
    height: 600px;
    width: 900px;
    position: relative;
    left: 200;
    top: 20;
}
#d1{
    height: 200px;
    width: 150px;
    box-shadow: 0px 0px 25px rgba(0,0,0,.5);
    position: absolute;
    top: 150px;
    background-image: url(https://images.pexels.com/photos/210182/pexels-photo-210182.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260);
    background-size: 1250px 750px;
    background-position:0px -150px;
    z-index: 2;
}
#d2{
    height: 500px;
    width: 400px;
    position: absolute;
    top: 80px;
    left: 100px;
    background-image: url(https://images.pexels.com/photos/210182/pexels-photo-210182.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260);
    background-size: 1250px 750px;
    background-position:-100px -80px;
    z-index: 1;
}
#d3{
    height: 600px;
    width: 400px;
    box-shadow: 0 0 25px rgba(0,0,0,.5);
    position: absolute;
    top:0px;
    left: 300px;
    background-image: url(https://images.pexels.com/photos/210182/pexels-photo-210182.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260);
    background-size: 1250px 750px;
    background-position:-300px 0px;
    z-index: 3;
}
#d4{
    height: 500px;
    width: 400px;
    position: absolute;
    top:30px;
    left: 500px;
    background-image: url(https://images.pexels.com/photos/210182/pexels-photo-210182.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260);
    background-size: 1250px 750px;
    background-position:-500px -30px;
    z-index: 1;
}
.content{
    height: auto;
    width: auto;
    border-right: 3px solid #fff;
    text-align: right;
    font-family: fantasy;
    font-size: 45px;
    letter-spacing: 5px;
    color: #fff;
    position: absolute;
    top: 200px;
    right: 200px;
    z-index: 99;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: