tubeshowcase●1,673,858 videos♡ My collection 0
← Learn to Code

Learn to Code1:17:59

Build a responsive, animated, accessible accordion that looks pretty good

Kevin Powell ↗

From the creator

Accordions are a pretty common thing that we find on websites these days, but they’re often… a little bit lacking, either with awkward animations, or a complete lack of animations, and sometimes just looking pretty ugly. I recently came across an awesome codepen by Zed Dash that looked fantastic, and I thought it would be the perfect starting place to creating a responsive, and importantly, very good looking accordion that could help add a little delight to a users experience with a site. 🔗 Links ✅ Zed Dash’s original codepen: https://codepen.io/z-/pen/OBPJKK ✅ The final code: https://github.com/kevin-powell/accordion ✅ ARIA authoring practices Accordion Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/accordion/ ✅ ARIA authoring practices Accordion Example: https://www.w3.org/WAI/ARIA/apg/patterns/accordion/examples/accordion/ ✅ Why details isn’t great for accordions (and many other things): https://adrianroselli.com/2019/04/details-summary-are-not-insert-control-here.html ✅ How to use heading levels properly: https://youtu.be/NexL5_Vdoq8 ✅ SVG Sprite creator: https://svgsprit.es ⌚ Timestamps 00:00 - Introduction 00:35 - The inspiration for what I’m going to build 01:17 - Building things out the right way 04:30 - The HTML 15:22 - The SVG icons 19:54 - The generic CSS stuff 21:38 - Setting up the panel styles 24:30 - Styling the icons 29:04 - Setting up the size of the panels and fixing up the button 39:43 - Dealing with the overflowing text 40:52 - The JavaScript - addi

Published 2023-04-04 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code