A list is an element in HTML used to display a sequence of items. There are two types of unordered lists and ordered lists, marked with dots or numbers/letters respectively. The syntax is
and
, and the list type, starting value, etc. can be specified through attributes. Lists can be nested, creating sublists within list items.
Usage of lists in HTML
What is a list?
A list is an element in HTML used to display a series of related or ordered items.
Type
There are two types of lists in HTML:
Syntax
The syntax for a list is as follows:
- 项目 1
- 项目 2
- 项目 3
Attributes
Nested lists
Lists can be nested, that is, sublists are created within list items:
- 项目 1
- 子项目 1
- 子项目 2
- 项目 2
Example
Unordered list:
- 苹果
- 香蕉
- 橙子
Ordered list:
- 星期一
- 星期二
- 星期三
Nested list:
- 动物
- 狗
- 猫
- 水果
The above is the detailed content of How to use list in html. For more information, please follow other related articles on the PHP Chinese website!