Skip to main content

Creating a Dark and Light Mode Toggle Button

 

#dark #light #mode #html #css #foryou #world #happy # website #webdesign #webdeveloper #how to #howto #trending #viral #srilanka #youtube #tiktok #blog  #howtocreate #Javascript #image #imageuploader #toggle 


In this #tutorial , we'll guide you through the process of creating a stylish #dark and #light Mode #toggle Button #foryourwebsite. Dark mode is not only visually appealing but also helps reduce eye strain in low-light conditions. We'll show you step by step how to implement this feature, making your website more user-friendly. By the end of this video, you'll have a fully functional Dark and Light Mode Toggle Button that enhances your website's user experience.

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Dark Light Mode</title>
</head>
<body>
     <div>
        <input type="checkbox" class="checkbox">
     </div>
</body>
</html>



style.css

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body{
    display: grid;
    height: 100vh;
    place-items: center;
    background-color: black;
}
.checkbox{
    height: 200px;
    background-color: rgb(149,124,124);
    border-radius: 100px;
    width: 400px;
    appearance: none;
    box-shadow: inset 0 10px 20px rgba(0,0,0,0.5),
    inset 0 10px 16px rgba(0,0,0,0.5),
    inset 0 -5px 20px rgba(0,0,0,0.5);
    outline: none;
    cursor: pointer;
    position: relative;
    transition: 0.5s;
    background-image: url(Image/nightsky.jpeg);
    background-size: cover;
}
.checkbox::before{
    height: 150px;
    width: 150px;
    position: absolute;
    top: 25px;
    left: 25px;
    content: '';
    background-color: linear-gradient(to bottom, black, black);
    border-radius: 50%;
    transition: 0.5s;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5),
    inset 4px 4px rgba(255,255,255,0.2),
    inset -4px  4px rgba(255,255,255,0.2);
    background-image: url(Image/sun.svg);
    background-size: cover;
}
.checkbox:checked{
    background-color: #fff;
    box-shadow: inset 0 20px 60px rgba(0,0,0,0.1),
    inset 0 2px 8px rgba(0,0,0,0.1),
    inset 0 4px 4px rgba(0,0,0,0.05);
    background-image: url(Image/sunshine.jpg);
    background-size: cover;
}
.checkbox:checked::before{
    left: 225px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1),
    inset 4px 4px rgba(255,255,255,0.5),
    inset -4px 4px rgba(255,255,255,0.5);
    background-color: linear-gradient(to bottom white , white);
    background-image: url(Image/moon.svg);
    background-size: cover;
}
.checkbox::after{
    content: '';
    position: absolute;
    height: 110vh;
    width: 100rem;
    background: black;
    top: 80px;
    left: 190px;
    z-index: -1;
    transform: translate(-50%, -50%);
    transition: 0.5s;
}
.checkbox:checked::after{
    background: white;
}























Comments

Popular posts from this blog

How to Create Animate Mic Logo

    Embark on a design and coding adventure with our tutorial on creating and animating a microphone logo using HTML and CSS. In this concise yet comprehensive guide, we'll navigate logo design principles, emphasizing simplicity and visual balance. Seamlessly transitioning to animation, we'll bring the mic logo to life, making it dynamic and engaging. What sets this tutorial apart is its accessibility—no complex software, just the power of code.🎙️✨ #logoanimation #designtutorial #webdevelopment Don't forget to like, share, and subscribe for more web development tutorials and tips. If you have any questions or need further assistance, feel free to leave a comment, and we'll be happy to help you out. Happy coding! Like Us On Facebook:    / codingwithnexusofficial   Follow Us On Instagram:    / coding_with_nexus   Follow Us On TikTok:    / coding.with.nexus  index.html <! DOCTYPE html > < ...

How to Create a Portfolio Web Site

    Unlock the power of web development with our step-by-step guide on building a stunning portfolio website using HTML and CSS! 🚀 Join us on this hands-on journey as we demystify the coding process, This video helps you craft a professional portfolio. Whether you're a beginner or looking to enhance your web development skills, this tutorial is your gateway to creating a standout digital presence. Elevate your portfolio game and showcase your talents to the world! 💻✨ index.html   <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < link rel = "stylesheet" href = "style.css" >     < script src = "https://kit.fontawesome.com/b186863b7d.js"     crossorigin = "anonymous" ></ script >     < title > Portfolio Website </ title >...

Create Cool Hover Effects for Cards with HTML & CSS (2024)

  Learn how to create stylish hover effects for cards using HTML and CSS in this tutorial. Watch step-by-step as we implement eye-catching animations to make your website's cards stand out. Perfect for web developers looking to enhance user experience and add a touch of interactivity to their projects. Get ready to impress with cool hover effects for cards!  Stay tuned for more web development tutorials. index.html  <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > Card </ title >     < link rel = "stylesheet" href = "style.css" > </ head > < body >     < div class = "card" >         < img src = "Image/paris_eiffeltower_ssk500.jpeg" alt = "EiffelTower" >         < div class = "...