Tree views in CSS
Styling a list of nested details
elements to create a beautiful lokking tree view, all in CSS, all nicely accessible.
This is nifty little piece of CSS for numbering nested lists. I don’t think I’ve come across the counter
value or the counter-reset
and counter-increment
properties before (or if I did, I’ve completely forgotten about it).
Styling a list of nested details
elements to create a beautiful lokking tree view, all in CSS, all nicely accessible.
Some very smart ideas in here for resetting default browser styles, like only resetting lists that have classes applied to them:
ul[class],
ol[class] {
padding: 0;
}
I select only lists that do have a
class
attribute because if a plain ol’<ul>
or<ol>
gets used, I want it to look like a list. A lot of resets, including my previous ones, aggressively remove that.
In which Matthew disects a multiple choice quiz that uses CSS to do some clever logic, using the :checked
pseudo-class and counter-increment
.
Oh, and this is how he realised it wasn’t using JavaScript:
I have JavaScript disabled on my phone because a) it cuts out most of the ads, b) it cuts out lots of bandwidth and I have a limited data plan, and c) my battery lasts longer because it’s not processing tons of code to show me some text (cough, Medium).
Yes! I’ve wanted this forever!
A clever way of styling list numbers and bullets in CSS. It feels like this should be its own pseudo-element already though, right? Well, that’s on the way.
Do websites need to sound the same in every screen reader?