Pure HTML and CSS Accordion
How do I make an pure html and css accordion?
Created and designed (in browser) a pure HTML and CSS expandable accordion for fun. I tried to think outside of the box when designing this (no pun intended).. What is a pure html and css accordion? How do you make a pure html and css accordion? This script and codes were developed by Chris Ota on 15 September 2022, Thursday.
Pure HTML and CSS Accordion - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure HTML and CSS Accordion</title> <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <ul class="accordion"> <li class="accordion-item"> <input id="s1" class="hide" type="checkbox"> <label for="s1"class="accordion-label">First</label> <ul class="accordion-child"> <li> <label> <input type="checkbox"> Item 1 </label> </li> <li> <label> <input type="checkbox"> Item 2 </label> </li> </ul> </li> <li class="accordion-item"> <input id="s2" class="hide" type="checkbox" checked> <label for="s2" class="accordion-label">Second</label> <p class="accordion-child">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce quis ultrices nunc. Suspendisse a magna purus. In hac habitasse platea dictumst. Nullam sed nisl quis sem dignissim luctus. Etiam luctus mauris nulla, et efficitur massa efficitur ac.</p> </li>
</ul>
</body>
</html>
Pure HTML and CSS Accordion - Script Codes CSS Codes
*, *:before, *:after { box-sizing: border-box;
}
html,
body { height: 100%;
}
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-family: roboto, helvetica, arial, san-serif; color: #666; background: #e0e0e0; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; height: inherit;
}
.hide { clip: rect(0 0 0 0); height: 1px; margin: -1px; padding: 0; position: absolute; width: 1px;
}
.accordion { background: #fff; width: 400px; border: 1px solid #e0e0e0;
}
.accordion-item { position: relative; width: 100%; border-bottom: 1px solid #e0e0e0;
}
.accordion-item:last-child { border-bottom: none;
}
.accordion-label { padding: 20px 0 20px 30px; width: 100%; display: block; font-size: 18px;
}
.accordion-label:hover { cursor: pointer;
}
.accordion-label:before { content: ''; position: absolute; height: 5px; width: 5px; top: 22px; left: 12px; display: inline-block; border-left: 5px solid #999; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
input[type=checkbox]:checked ~ .accordion-label:before { -webkit-transform: rotate(90deg); transform: rotate(90deg);
}
.accordion-child { margin: 0; overflow: hidden; -webkit-transition: all 0.3s ease; transition: all 0.3s ease; opacity: 0; height: 0; -webkit-transform: scale(1, 0); transform: scale(1, 0); -webkit-transform-origin: center top; transform-origin: center top;
}
input[type=checkbox]:checked ~ .accordion-child { border: 1px solid #e0e0e0; margin: 0 -20px 15px -20px; background: #fff; box-shadow: 0 3px 6px 1px rgba(0, 0, 0, 0.16); padding: 30px; height: auto; opacity: 1; -webkit-transform: scale(1, 1); transform: scale(1, 1);
}
Developer | Chris Ota |
Username | chrisota |
Uploaded | September 15, 2022 |
Rating | 4.5 |
Size | 3,485 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 |
For Fun | 3,087 Kb |
Single Element Knob | 1,971 Kb |
Origami Penguin | 4,204 Kb |
Random Wrist Watch | 7,665 Kb |
Two Element Typeface | 4,942 Kb |
Thank You Dribbble Card | 2,787 Kb |
Simple Toggle Switch | 2,829 Kb |
Lego Man | 5,277 Kb |
Single HTML Element Icons | 8,967 Kb |
Mobile Table with Comparison View | 5,946 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 |
Materializecss input form | Jasonchan | 1,443 Kb |
Text Looping Transition | Agelber | 5,619 Kb |
Base64 SVG Me | MrBambule | 44,786 Kb |
Pure CSS Tooltip | APinix | 2,815 Kb |
A Pen by Bryan Rojas | Bryanrojas | 1,873 Kb |
Brown by pure CSS, no image, no javascript | Aaronchuo | 2,652 Kb |
Sony Xperia Z3 Flat MockUp | Dapinitial | 4,379 Kb |
Heatmap Color Scales | Stevepepple | 2,331 Kb |
Pink expansion tunnel | Vez | 1,738 Kb |
After America | Jonathangarner | 2,686 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!