Pure CSS Toggle Function
How do I make an pure css toggle function?
Simple method for creating a toggle function using only CSS - no JS required.. What is a pure css toggle function? How do you make a pure css toggle function? This script and codes were developed by James Zedd on 11 October 2022, Tuesday.
Pure CSS Toggle Function - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure CSS Toggle Function</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="site-title"> <h1>Elite World Explorer</h1> </div> <div class="content"> <h1>5 Best Desinations in the World</h1> <img src="https://placehold.it/700x250" alt="" class="" /> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse eget nulla mollis, efficitur urna nec, viverra dolor. Nulla facilisi. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent efficitur finibus eros sit amet sagittis. Ut sollicitudin sodales neque et volutpat. Curabitur dictum ante vel fermentum volutpat. Curabitur ac neque et erat viverra egestas.</p> <label for="showToggle">Show Toggle</label> <input type="checkbox" id="showToggle" /> <div class="toggle-box"> <h2>Sign up for our mailing list</h2> <input type="text" placeholder="First Name" /> <input type="text" placeholder="Email Address" /> <button type="submit">Submit</button> </div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse eget nulla mollis, efficitur urna nec, viverra dolor. Nulla facilisi. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent efficitur finibus eros sit amet sagittis. Ut sollicitudin sodales neque et volutpat. Curabitur dictum ante vel fermentum volutpat. Curabitur ac neque et erat viverra egestas.</p> </div>
</div> <script src="js/index.js"></script>
</body>
</html>
Pure CSS Toggle Function - Script Codes CSS Codes
.container { padding: 20px; font-family: 'Lato', arial, sans-serif; max-width: 700px; margin: 0 auto;
}
.site-title { text-align: center; border-bottom: 1px solid #111111; margin-bottom: 24px;
}
.site-title h1 { font-weight: 300; text-transform: uppercase; letter-spacing: 10px;
}
img { width: 100%;
}
.content p { line-height: 1.6em; margin-bottom: 24px;
}
label { cursor: pointer; padding: 12px 18px; border-radius: 12px; background: #31b0d5; color: #ffffff; transition: all 300ms ease-in-out;
}
label:hover { background: #269abc;
}
#showToggle { display: none;
}
.toggle-box { border-radius: 12px; margin-top: 18px; padding: 0 18px; background: #f1f1f1; height: 0; overflow: hidden; transition: all 300ms linear;
}
.toggle-box h2 { margin-top: 0;
}
.toggle-box input { text-indent: 4px; padding: 4px 0; border-radius: 4px; border: 2px solid #ffffff; margin-bottom: 12px;
}
/*-- The Magic --*/
#showToggle:checked + .toggle-box { padding: 24px 18px; height: 90px;
}
/* -- */
@media (max-width: 550px) { .toggle-box input { display: block; width: 100%; box-sizing : border-box; } #showToggle:checked + .toggle-box { padding: 24px 18px; height: 180px;
}
}
Pure CSS Toggle Function - Script Codes JS Codes
// nothing to see here :P
Developer | James Zedd |
Username | james_zedd |
Uploaded | October 11, 2022 |
Rating | 3 |
Size | 2,566 Kb |
Views | 10,120 |
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 |
Simple jQuery Selector Class Change | 1,802 Kb |
Simple Opt In Form | 3,203 Kb |
Price | 3,043 Kb |
CSS Menu Item Transition and Image Animation | 2,184 Kb |
A Pen by James Zedd | 2,674 Kb |
Flex Chart | 4,111 Kb |
The Lonely Planet | 8,286 Kb |
Responsive Advert | 2,354 Kb |
FS Core Values | 2,020 Kb |
Pure CSS Pop Up Modal | 2,858 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 |
Rain Landing in a Pond | Edball | 3,009 Kb |
Button fills | Zubfatal | 5,205 Kb |
CSS3 Button Examples | Volusion | 3,377 Kb |
404 Error Page | WebSonick | 3,203 Kb |
Eunice A | Ejbronze | 2,203 Kb |
DNA Double Helix | Hugo | 5,112 Kb |
Tree growth tests | Orchard | 3,818 Kb |
Growing Root - Scroll control - CANVAS | Cjonasw | 2,342 Kb |
Web Spiral - p5.js | TWAIN | 2,183 Kb |
Flexbox slider | Rendro | 3,459 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!