List-item
A list-item is an individual element within a list. It can appear in ordered (numbered) or unordered (bulleted) lists and serves to present one unit of information, step, or option.
Key points
- Structure: In HTML, a list item is represented by the
- tag and must be nested inside
- (unordered list) or
- Purpose: Breaks content into discrete, scannable pieces for readability and organization.
- Types:
- Ordered list items imply sequence or priority.
- Unordered list items imply grouping without order.
- Styling: Appearance (bullets, numbers, indentation) is controlled by CSS (e.g., list-style-type, margin, padding).
- Accessibility: Use semantic lists for screen readers; ensure list structure is logical and avoid using lists purely for layout.
- Nesting: Lists can be nested by placing a new
- or
- inside
- (ordered list).
Example (HTML)
html
<ul><li>First item</li> <li>Second item <ul> <li>Nested item</li> </ul> </li> <li>Third item</li></ul>
Leave a Reply