![]() |
VOOZH | about |
HTML lists are a fundamental part of web development, used to organize and present information in a structured and readable format. While they may seem simple, HTML lists have some interesting features and nuances that make them versatile and powerful.
The <dl> element isn’t just for glossaries—it’s ideal for structuring key-value pairs like metadata, settings, or attributes. Each <dt> (term) can have multiple <dd> (descriptions), creating semantic relationships.
CSS counters (counter-reset, counter-increment) allow custom hierarchical numbering (e.g., 1.1, 1.2) in nested lists, overriding default browser behavior.
valueThe value attribute in <li> lets you restart or skip numbering mid-list in ordered lists.
The reversed attribute in <ol> decrements numbering (e.g., 5, 4, 3) while maintaining semantic order in the DOM. Assistive technologies announce items in visual order.
startThe start attribute attribute resumes numbering across separate <ol> elements, mimicking a single continuous list.
valueThe value attribute attribute on <li> forces a specific number, overriding the default sequence. Subsequent items follow the new value.
Convert vertical lists to horizontal menus using CSS while preserving semantics for screen readers.
The start attribute forces ordered lists to begin at a custom number.
Lists inside Shadow DOM components retain their styles without global CSS interference.