Vanilla CSS Switcher
How do I make an vanilla css switcher?
Just HTML and CSS. No JS and animations. Idea by Artem Shykov.. What is a vanilla css switcher? How do you make a vanilla css switcher? This script and codes were developed by Maxim Konoval on 31 December 2022, Saturday.
Vanilla CSS Switcher - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Vanilla CSS Switcher</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="global_wrapper"> <div class="switcher_wrapper"> <input id="switcher" type="checkbox" name="switcher"> <label for="switcher" class="switcher_checkbox"> <span>Vanilla CSS Switcher</span> <span class="checker"> <span class="checker_short-line"></span> <span class="checker_long-line"></span> </span> </label> </div>
</div> <script src="js/index.js"></script>
</body>
</html>
Vanilla CSS Switcher - Script Codes CSS Codes
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 18px; line-height: 24px;
}
.global_wrapper { width: 99vw; min-height: calc(100vh - 25px); display: flex; justify-content: center; align-items: center;
}
.switcher_wrapper { width: 100%; max-width: 340px; height: 50px;
}
#switcher { position: absolute; opacity: 0; z-index: -1; visibility: hidden;
}
.switcher_checkbox { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 100%; padding-right: 15px; padding-left: 15px; cursor: pointer; color: #000; background-color: #f6f8f9; border: 1px solid #dadfe3; border-radius: 30px; transition: all .25s ease;
}
#switcher:checked + .switcher_checkbox { color: #fff; background-color: #05c096;
}
.checker { position: relative; width: 30px; height: 30px; background-color: #fff; border: 1px solid #dadfe3; border-radius: 100%; transition: all .25s ease;
}
#switcher:checked + .switcher_checkbox,
#switcher:checked + .switcher_checkbox .checker { border-color: transparent;
}
.checker_short-line,
.checker_long-line { position: absolute; overflow: hidden; height: 3px; background-color: transparent; transform-origin: left;
}
.checker_short-line { top: 11px; left: 6px; width: 10px; transform: rotate(44.5deg);
}
.checker_long-line { top: 19px; left: 12px; width: 17px; transform: rotate(-45deg);
}
.checker_short-line::before,
.checker_long-line::before { content: ""; position: absolute; width: 100%; height: 100%; background-color: #05c096; transform: translateX(-110%); transform-origin: left; transition: all .15s ease;
}
#switcher:checked + .switcher_checkbox .checker_short-line::before,
#switcher:checked + .switcher_checkbox .checker_long-line::before { transform: translateX(0);
}
.checker_long-line::before,
#switcher:checked + .switcher_checkbox .checker_short-line::before { transition-delay: 0s;
}
.checker_short-line::before,
#switcher:checked + .switcher_checkbox .checker_long-line::before { transition-delay: .12s;
}
Vanilla CSS Switcher - Script Codes JS Codes
// Just don't need it
Developer | Maxim Konoval |
Username | Said_FD |
Uploaded | December 31, 2022 |
Rating | 3 |
Size | 2,296 Kb |
Views | 24,288 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
A Pen by Maxim Konoval | 1,609 Kb |
Vanilla CSS Accordion and Responsive Tables | 3,826 Kb |
Animated Form | 3,485 Kb |
CRM Table Test | 7,579 Kb |
Tactical Monkey | 2,889 Kb |
Brutal Responsive Landing Page Prototype | 5,482 Kb |
Animated Carousel on CSS with Minimal JS | 6,787 Kb |
SVG Scalable Text | 1,451 Kb |
CS-Service Landing Page | 6,657 Kb |
Structure Test | 6,467 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Social.svg.min | Larsenwork | 13,849 Kb |
Buttons for autumn | Nikazawila | 1,795 Kb |
Custom Select Element | Agrayson | 3,616 Kb |
CSS3 Button Examples | Volusion | 3,377 Kb |
Freecodecamp - Tribute Page | Samoht513 | 3,583 Kb |
RPG Style Text Dialogue | Odylic | 2,635 Kb |
Vue.js Starter | Andymerskin | 1,268 Kb |
Flex layout example | Mofny | 1,663 Kb |
Multiple jCarousel | Pafnuty | 2,461 Kb |
A Pen by Adrien Clerbois | AClerbois | 6,501 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!