There are three types of lists in HTML:
Unordered List
Unordered lists are used to display a list of items in no particular order. Each item in the list is enclosed in an <li>
tag and marked with a bullet point (or some other symbol).
For example:
<ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul>
This will produce an output like the following:
• Item 1 • Item 2 • Item 3
Ordered List
Ordered lists are used to display a list of items in a specific order, that are numbered or lettered. Each item in the list is enclosed in an <li>
tag.
For example:
<ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol>
This will produce an output like the following:
1. Item 1 2. Item 2 3. Item 3
Definition List
Definition lists are used to display a list of terms and their corresponding definitions. Each term is enclosed in a <dt>
tag and each definition is enclosed in a <dd>
tag.
For example:
<dl> <dt>Term 1</dt> <dd>Definition 1</dd> <dt>Term 2</dt> <dd>Definition 2</dd> <dt>Term 3</dt> <dd>Definition 3</dd> </dl>
This will produce an output like the following:
Term 1 Definition 1 Term 2 Definition 2 Term 3 Definition 3
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.