Ordered Lists (<ol>
) and Unordered Lists (<ul>
): Creating lists to organize information. List items (<li>
): Understanding list item elements and their usage within ordered and unordered lists. Nested lists: Creating hierarchical lists for better content organization.
-
Definition:
Lists (<ul>
for unordered lists and<ol>
for ordered lists) are used to group related items together. Each item within a list is represented by the<li>
element. -
Element Type:
Block-level -
Why Use This:
Lists provide a logical and organized way to present information, making it easier for users to scan and comprehend content. They improve readability and help users understand relationships between different items. -
Available Resources:
- Text content
-
Recommendation:
Use lists to organize and present content in a structured manner. Choose between ordered and unordered lists based on the sequence or significance of items. Avoid using lists for layout purposes and prioritize semantic meaning. -
Example:
<ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> <ol> <li>First item</li> <li>Second item</li> <li>Third item</li> </ol>
- Explanation:
- Lists can be ordered (
<ol>
) or unordered (<ul>
). - List items (
<li>
) define individual items within a list. - Ordered lists display items with sequential numbers or letters, while unordered lists display items with bullet points.
- Lists can be ordered (