Articles → HTML → Lists In HTML
Lists In HTML
What Is A List?
Types Of Lists
- Ordered list
- Unordered list
- Description list
Ordered List
Syntax
<ol><li>item1</li><li>item 2</li></ol>
Example
- Gather requirements
- Check the feasibility
- Requirements sign off
- Design a system
- Development
- Testing
- Delivery
<html>
<head>
<title>List Demo</title>
</head>
<body>
<ol>
<li>Gather requirements</li>
<li>Check feasibility</li>
<li>Requirements sign off</li>
<li>Design system</li>
<li>Development</li>
<li>Testing</li>
</ol>
</body>
</html>
Try It
Type Attribute
List item marker type | Description |
---|
Type = ‘1’ | List will start with a number. The first list item marker would be 1 followed by 2, 3, and so on |
Type = ‘a’ | List will start with a lowercase alphabet. The first list item marker would be a followed by b, c, and so on |
Type = ‘A’ | List will start with an upper-case alphabet. The first list item marker would be A followed by B, C, and so on |
Type = ‘i’ | List will start with a lowercase roman number. The first list item marker would be "i" followed by ii, iii, and so on |
Type = ‘I’ | List will start with the upper-case roman number. The first list item marker would be I followed by II, III, and so on |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<ol Type="1">
<li>Gather requirements </li>
<li>Check feasibility </li>
<li>Requirements sign off </li>
<li>Design system </li>
<li>Development </li>
<li>Testing </li>
</ol>
<ol Type="a">
<li>Gather requirements </li>
<li>Check feasibility </li>
<li>Requirements sign off </li>
<li>Design system </li>
<li>Development </li>
<li>Testing </li>
</ol>
<ol Type="A">
<li>Gather requirements </li>
<li>Check feasibility </li>
<li>Requirements sign off </li>
<li>Design system </li>
<li>Development </li>
<li>Testing </li>
</ol>
<ol Type="i">
<li>Gather requirements </li>
<li>Check feasibility </li>
<li>Requirements sign off </li>
<li>Design system </li>
<li>Development </li>
<li>Testing </li>
</ol>
<ol Type="I">
<li>Gather requirements </li>
<li>Check feasibility </li>
<li>Requirements sign off </li>
<li>Design system </li>
<li>Development </li>
<li>Testing </li>
</ol>
</body>
</html>
Try It
Unordered List
Example
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<ul>
<li>Milk</li>
<li>Sugar</li>
<li>Coffee</li>
</ul>
</body>
</html>
Try It
List-Style-Type Property
- Disc → Specifies the list item marker in the bullet shape
- Circle → Specifies the list item marker in a circle shape
- Square → Specifies the list item marker in a square shape
- None → No marking for list item
Example
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<ul style="list-style-type:disc">
<li>Milk</li>
<li>Sugar</li>
<li>Coffee</li>
</ul>
<ul style="list-style-type:circle">
<li>Milk</li>
<li>Sugar</li>
<li>Coffee</li>
</ul>
<ul style="list-style-type:square">
<li>Milk</li>
<li>Sugar</li>
<li>Coffee</li>
</ul>
<ul style="list-style-type:none">
<li>Milk</li>
<li>Sugar</li>
<li>Coffee</li>
</ul>
</body>
</html>
Try It
HTML Description List
Example
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<dl>
<dt>Yellow Pulse</dt>
<dd>
Fresh yellow pulse boiled and added spices for taste</dd>
<dt>Pizza </dt>
<dd>
Freshly baked base with fresh vegatables.
</dd>
</dl>
</body>
</html>
Try It
- dl → Description List
- dt → Description Term
- dd → description
Browser Support
Internet Explorer | Firefox | Chrome | Safari | Opera | Edge |
---|
Yes | Yes | Yes | Yes | Yes | Yes |