Types of HTML Lists
- (ol)- Ordered List
- (ul)- Unordered List(Bulleted list)
- (dl)- Description List
HTML List Tags Examples
Ordered List /Numbered List (ol)
The <ol> tag is used to create an ordered list and <li> tag starts the list of items. It is also called as a numbered list because list items are marked with numbers.
Different list styles in ordered list
Apart from the normal list style, there are other styles as well. The default list will always start from 1.
Suppose, you want to create an ordered list which should not start from 1, then you have to exclusively set the particular ordered list type.
The Syntax of different list types:
where, value can be a number or alphabet
The important ordered list types are –
- type=”1″ – To start the ordered list like 1,2,3 etc.
- start=”4″ – It will create an ordered list starting from 4. Example – 4, 5, 6 etc
- type=”a” – ordered list will start from a in alphabetical order like a, b, c etc
- type=”A”– ordered list will start from A in alphabetical order like A, B, C etc
- type=”I” – This will create ordered list in Roman alphabet in capitals.
- type=”i” – This will create ordered list in Roman alphabet in small letters.
HTML5 does not support the type attribute so it is better to use CSS.
Example of different list types in ordered list
Unordered List /Bulleted List (ul)
In HTML Lists, <ul> tag list starts with unordered list and list item starts with <li> tag. It is also called as a bulleted list because list items are marked with bullets.
Different bullets styles in unordered list
Apart from the normal bullet style, there are other styles for unordered list as well like disc, square, circle etc.
Example of different bullets in unordered list
- The list-style-type:none is mostly used for creating Navigation bars.
- For unordered list, you can use any of the 2 syntax’s like –
- ul style=”list-style-type:square”> or
- <ul type =”square”>
Description List /Definition List (dl)
HTML and XHTML supports Description list.
<dl> − It defines the start of description list.
<dt>− This tag defines term in description list.
<dd>− This tag describes Term description in definition list.
Interview Questions & Answer
Ordered list – It displays the elements in numbered format. It is represented by <ol> tag.
Unordered list – It displays the elements in bullet format. It is represented by <ul> tag.
Definition list – It displays elements in definition form like in dictionary. The <dl>, <dt> and <dd> tags are used to define description list.
<dl> — It defines the start of description list..
<dt> — This tag defines term in description list.
<dd> — Describes Term description in definition list.
The tag includes two attributes – type and value. The type attribute can be used to change the numbering type for any list item. The value attribute can change the number index.
Here is code to make a bulleted list in HTML.