HTML Lists
HTML Lists
HTML Lists provide various ways to create lists to organize and display items in a structured manner. There are three primary types of lists in HTML:
- Unordered Lists
- Ordered Lists
- Definition Lists.
Unordered Lists
An unordered list is used to group related items in no particular order. It is typically displayed with bullet points.
Syntax:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Example:
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
</ul>
Ordered Lists
An ordered list groups a set of related items in a specific order. The items in an ordered list are typically displayed with numbers or letters.
Syntax:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Example:
<ol>
<li>Step 1</li>
<li>Step 2</li>
<li>Step 3</li>
</ol>
Definition Lists
A definition list displays a list of terms and their corresponding definitions. It is useful for glossaries or descriptions.
Syntax:
<dl>
<dt>Term 1</dt>
<dd>Definition 1</dd>
<dt>Term 2</dt>
<dd>Definition 2</dd>
</dl>
Example:
html
Copy code
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
<dt>JavaScript</dt>
<dd>Programming language for web development</dd>
</dl>
By understanding these basic list types and how to use them, you can create well-organized and structured content in your HTML documents.
—
HTML Tutorials
HTML Tutorials on this website: