3 ms·
> The reversed attribute is used to reverse ordered lists (<ol>) in the opposite order. Holy shit that’s been a thing for ten years and I didn’t know about it?
by mock-possum 3y ago
> The reversed attribute is used to reverse ordered lists (<ol>) in the opposite order.
Holy shit that’s been a thing for ten years and I didn’t know about it??
- chrismorgan 3y agoWell, IE and EdgeHTML never supported it, so in practice it’s only been safe to use for twoish years. (I’d actually completely forgotten it was a recent addition rather than from the pre-HTML-5 era.)
- ghusbands 3y ago> > > The reversed attribute is used to reverse ordered lists (<ol>) in the opposite order. To be clear, it only makes the numbers descending rather than ascending. The phrasing above implies it rearranges the list.
- pseudoramble 3y agoYeah the behavior was completely counter intuitive to what I was expecting. It does make sense though since it would be kinda weird if an HTML attribute could change the structure of mark up directly, at least I realized that after thinking about it.
- liftm 3y agoHow does this help accessibility, though? (Maybe I don't know enough about HTML. Is the usual way to produce a descending enumeration to write the elements in reverse order and then re-reverse them in CSS or so, which makes them be read wrong by screen readers?)
- CM30 3y agoThat's a good point. There's no obvious way to mark up a HTML list as being reversed in CSS alone, at least not without a bunch of Flexbox styles and stuff. So the likelihood that someone would use an unsemantic alternative for this is basically non existent.
- chrismorgan 3y agoThe alternative is just specifying the value on each item. These two are equivalent: <ol reversed> <li>Three <li>Two <li>One </ol> <ol> <li value=3>Three <li value=2>Two <li value=1>One </ol> Note also that reversing content via CSS is generally unwise, because things like screen readers, text selection and tab indexing operate on DOM tree order.