Accessible HTML Tabs For Web Pages
I'm adding tabs to show different examples for a color picker in Neopoligen neo .
I found a video on how to make "CSS only" tabs that looked good but never mentioned accessibility. I checked with folks on a few discords for guidance and learned it's got problems. Specifically, it's not currently possible to make CSS only tabs in an accessible way.
Chris Ferdinandi from Go Make Things gmt and Mayank from mayank.co mayank sent over some better alternatives. Here's Mayank's approach with some specific styles added into the CSS below.
This is my local copy of the code for my notes. I've added nothing new here except a few styles. Be sure to visit Mayank's post for the original code and details
JavaScript
customElements.;
CSS
}
}
}
}
}
Endnotes
I'm not linking to the original video since the technique isn't accessible and I don't want to add to its SEO. It's called "How to Easily Create Pure CSS Tabs (No JavaScript Needed!)" by "dcode" if you want to look it up
Footnotes
- Neopoligen
The website building app I'm currently working on. As I'm writing this the first preview version is out with another more usable version on the way soon
References
-
This is the original post with the code from above.
-
This is Chris Ferdinandi's approach to tabs. I don't have enough knowledge to speak about the difference but it looks good too