Day & Night Page Effect By This Source Code
HTML CODE
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title> Day Night Toggle | Maa Blogger</title>
<link rel="stylesheet" href="style.css">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<input type="checkbox" id="switch">
<div class="outer">
<div class="content">
<label for="switch">
<span class="toggle">
<span class="circle"></span>
</span>
</label>
<div class="image-box">
<img src="https://www.smitcreation.com/sc/05/19593/19593.jpg" alt="">
</div>
<div class="details">
<div class="name">World Laughter Day | First Sunday Of Every May (2 May)</div>
<div class="job">“Laughter is the tonic, the relief, the surcease for pain” and “A day without laughter is a day wasted”</div>
<div class="buttons">
<p> Laughter can change the world in a peaceful and positive way. It is said that laughter is a universal language that has the potential to unite humanity. This year the celebration goes online due to COVID-19. The mission is Health, happiness and world peace through laughter. </p>
<button>Show More</button>
</div>
</div>
<div class="media-icons">
<i class="fab fa-facebook-f"></i>
<i class="fab fa-twitter"></i>
<i class="fab fa-telegram"></i>
</div>
</div>
</div>
</div>
</body>
</html>
CSS CODE
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Rockwell';
}
.outer{
height: 100vh;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background: url(https://image.freepik.com/free-photo/empty-white-studio-backdrops-spotlight-entertainment-room-background-with-showing-scene_79161-1143.jpg);
}
#switch:checked ~ .outer{
background: url(https://static.vecteezy.com/system/resources/previews/001/947/742/non_2x/modern-spot-light-background-free-vector.jpg) center;
}
.content{
display: flex;
width: 970px;
padding: 15px;
background: none;
border-radius: 12px;
position: relative;
box-shadow: 3px 5px 10px rgba(25, 50, 0, 4.50);
}
#switch:checked ~ .outer .content{
background: none;
}
.outer .toggle{
position: absolute;
width: 40px;
height: 30px;
border-radius: 20px;
background: #092c3e;
right: 15px;
top: 13px;
display: flex;
align-items: center;
cursor: pointer;
}
#switch:checked ~ .outer .toggle{
background: #fff;
}
.outer .toggle .circle{
margin-left: 3px;
height: 16px;
width: 16px;
border-radius: 50%;
background: #fff;
transition: all 0.3s ease;
}
#switch:checked ~ .outer .circle{
margin-left: 22px;
background: #092c3e;
}
.image-box {
height: 282px;
width: 350px;
border-radius: 12px;
padding: 3px;
background: #092c3e;
}
.image-box img {
height: 100%;
width: 100%;
object-fit: fit;
border: 3px solid #fff;
border-radius: 12px;
}
#switch:checked ~ .outer .image-box{
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}
#switch:checked ~ .outer .image-box img{
border-color: transparent;
}
.content .details{
width: 58%;
margin: 10px 0 20px 20px;
color: #092c3e;
}
#switch:checked ~ .outer .details{
transition: 0.1s;
color: #fff;
}
.content .details .name{
font-size: 30px;
font-weight: 600;
}
.content .details .job{
font-size: 18px;
font-weight: 500;
}
.content .details p{
font-size: 15px;
margin-top: 6px;
}
.content button{
display: block;
margin-top: 16px;
outline: none;
border: none;
font-size: 15px;
padding: 6px 14px;
border-radius: 6px;
color: #fff;
cursor: pointer;
background: #092c3e;
transition: all 0.3s ease;
}
.content button:hover{
transform: scale(0.97);
}
#switch:checked ~ .outer button{
background: #fff;
color: black;
}
.media-icons{
position: absolute;
bottom: 16px;
right: 15px;
margin-top: 12px;
justify-content: flex-end;
}
.media-icons i{
display: inline-flex;
margin: 0 4px;
font-size: 25px;
color: #006AFF;
opacity: 0.7;
cursor: pointer;
}
.media-icons i:hover{
opacity: 1;
}
#switch:checked ~ .outer i{
color: #fff;
opacity: 1;
}
#switch{
display: none;
}
OUTPUT SCREEN
14 Comments
Interesting facts effect
ReplyDeletePerfect 👌 👌 👌 👌
ReplyDeleteAwesome
ReplyDeleteExcellent
ReplyDeleteNicely done
ReplyDeleteSuperb
Awesome
ReplyDelete&
Nice
Awesome
ReplyDeleteGuys
Brilliant Brilliant
ReplyDeleteLovely
ReplyDeletePerfect work
ReplyDeleteAwesome
ReplyDeletegood creation
ReplyDeleteAttractive
ReplyDeleteInteresting
ReplyDelete