Lists and Collections
Lists and Collections: Lists Hold Collections: ul, ol and What the Browser Adds, Styling a List That Stays a List, Lists as Containers: Strip the Defaults,…
Updated
- Lists Hold Collections: ul, ol and What the Browser Adds (Apprentice): Menus, pet cards, tags and steps are collections of similar things, and writing them as a ul or an ol tells a screen reader how many there are, while the browser adds bullets, an indent and margins you can find in the developer tools.
- Styling a List That Stays a List (Apprentice): When a list should still look like a list, list-style-type, list-style-position, the list-style shorthand and ::marker change its bullets and numbers, and a few spacing rules make long and nested lists comfortable to read.
- Lists as Containers: Strip the Defaults, Style the Items (Apprentice): Many lists shouldn't look like lists at all, so you strip one list's bullets, indent and margins with three declarations on its class, then style each li as a box, such as a card or a menu row with a link that fills it.
- Lists Side by Side, by Hand (Apprentice): A menu across the top of a page and a row of tag pills are lists whose items sit side by side, and display inline-block does it by hand, with the gap the HTML's spaces add, vertical-align and text-align to line the row up, and wrapping that comes free.