List and nested list and description list and types of lists in HTML:
HTML lists are used to organize and display data in a list format.
There are three types of lists in HTML:
unordered lists,
ordered lists,
definition lists.
Unordered List:
Created using the <ul> element, which stands for unordered list.
Each list item is created using the <li> element.
The list items are displayed with bullet points.
Ordered List:
Created using the <ol> element, which stands for an ordered list.
Each list item is created using the <li> element.
The list items are displayed with numbers or letters.
Definition List:
Created using the <dl> element, which stands for definition list.
The <dt> element is used to create the term or phrase being defined.
The <dd> element is used to create the definition or description of the term.
Nested lists can be created by placing one list inside another. For example, an unordered list can be placed inside a list item of an ordered list.
Example:
- List item 1
- List item 2
- Nested list item 1
- Nested list item 2
- List item 3
- List item 1
- List item 2
- List item 3
- Term 1
- Definition 1
- Term 2
- Definition 2
<ul>
<li>List item 1</li>
<li>List item 2
<ul>
<li>Nested list item 1</li>
<li>Nested list item 2</li>
</ul>
</li>
<li>List item 3</li>
</ul>
<ol>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ol>
<dl>
<dt>Term 1</dt>
<dd>Definition 1</dd>
<dt>Term 2</dt>
<dd>Definition 2</dd>
</dl>
No comments:
Post a Comment