Pure CSS Accordion Menu
How do I make an pure css accordion menu?
A super, super simple Pure CSS accordion menu for one item. No dependencies, and a lot of flexibility.. What is a pure css accordion menu? How do you make a pure css accordion menu? This script and codes were developed by Lachlan Campbell on 24 September 2022, Saturday.
Pure CSS Accordion Menu - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure CSS Accordion Menu</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="panel"> <input type="checkbox" class="accordion-button" id="accordion-button"> <label for="accordion-button" class="accordion-label"> Pure CSS Accordion Menu </label> <div class="content"> <p>I wanted to make an accordion menu purely out of CSS. This is an incredibly simple solution using a <code>input type="checkbox"</code>, <code>label</code>, and a <code>div</code>. The label is hooked up to the hidden checkbox using <code>for</code>, and the CSS toggles <code>:before</code> and <code>display</code>. Click the header to close it again. </div> </div>
</div> <script src="js/index.js"></script>
</body>
</html>
Pure CSS Accordion Menu - Script Codes CSS Codes
#accordion-button, .content { display: none;
}
.accordion-label:before { content: '(click to open)';
}
#accordion-button:checked ~ .accordion-label:before { content: '(click to close)';
}
.accordion-label { cursor: pointer;
}
#accordion-button:checked ~ .content { display: block;
}
/* --------- */
body { width: 100%; height: 100%; background-color: #F2F2F2;
}
.panel { margin: 15% auto; display: block; padding: 1em;
}
Pure CSS Accordion Menu - Script Codes JS Codes
// No JS!
Developer | Lachlan Campbell |
Username | lachlanjc |
Uploaded | September 24, 2022 |
Rating | 3 |
Size | 2,038 Kb |
Views | 54,648 |
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 |
Noodles Landing Page 1.0 | 5,017 Kb |
Basecamp 3 Document | 3,811 Kb |
Spinner | 22,154 Kb |
Drawing a Terminal with CSS | 3,185 Kb |
Recipe - Banana Walnut Cake | 3,617 Kb |
Noodles Tags | 1,915 Kb |
Bananner | 2,964 Kb |
A Pen by Lachlan Campbell | 3,870 Kb |
Social Profiles | 1,939 Kb |
Merriam-Webster Dictionary | 4,297 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 |
Bloomberg Style Link Hover | Gil-- | 1,609 Kb |
TinFoil Boats | Chandralil | 4,577 Kb |
Search field | Jamesbarnett | 2,100 Kb |
A Pen by Manoz | Manoz | 2,424 Kb |
RAQuote | Naderk007 | 4,412 Kb |
Old calculator | Gnarfugh | 2,815 Kb |
Fixed Scrolling Nav Bar | Philsinatra | 0 Kb |
Collapsing Widget | Er40 | 4,279 Kb |
Sitemap generator for Sharepoint | Gyusza | 2,518 Kb |
Process Accordion | Devilskitchen | 31,432 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!