Hi, I will provide a free code for all of you on my YouTube channel, in learn Dark And Light Mode Using HTML, CSS and Javascript. The learning is very easy, simple and easy to understand for beginners, good luck, good luck, my advice is don't forget to keep learning and repeat until you can, happy coding. have a nice day friend.
This is my post for the previous one, you just have to learn it properly, and I will provide the latest updates about teaching web design quickly and easily
The best way is to always learn and practice directly, don't get hung up on confusing code, if you enter the wrong code, don't panic
This is the code HTML and CSS you need learn :
This is the code HTML and CSS you need learn :
1. 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>channel</title>
<link rel="stylesheet" href="https://cdnjs.
cloudflare.com/
ajax/libs/font-awesome/5.15.3/css/all.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div class="icons">
<div id="theme-toggler" class="fas fa-moon"></div>
</div>
</header>
<script src="script.js"></script>
</body>
</html>
2. CSS
*{
margin:0; padding:0;
box-sizing: border-box;
transition:.2s linear;
}
body.active{
background:#222;
}
header{
display: flex;
}
header .icons {
margin: auto;
padding-top: 17rem;
}
header .icons div{
height: 7rem;
width: 7rem;
font-size: 3.5rem;
line-height: 7rem;
background: #333;
color:#fff;
text-align: center;
border-radius: 50%;
cursor: pointer;
margin-right: .7rem;
}
header .icons div:hover{
background: #ff9502;
color:#fff;
transform:scale(1.1);
}
3. Javascript
let themeToggler = document.querySelector('#theme-toggler');
themeToggler.onclick = () =>{
themeToggler.classList.toggle('fa-sun');
if(themeToggler.classList.contains('fa-sun')){
document.querySelector('body').\
classList.add('active');
}else{
document.querySelector('body').
classList.remove('active');
}
}
For more details, you can see the Video tutorial and Click link Channel below :
For more details, you can see the link YouTube below :
https://youtu.be/OtviFwoftgg
Support my channel. Comment, like and subscribe, success for all of us, happy world hereafter. Amin, Good Luck. 😀
Download Free Code ZIP : DOWNLOAD NOW
Belum ada tanggapan untuk "Dark And Light Mode Using HTML, CSS and Javascript"
Post a Comment