HTML provides several list modes
HTML provides 3 list modes: 1. Ordered list, created using "
" and "
- " tags, the contents between the ordered lists are in order; 2. Create an unordered list using the "
" and "
- " tags; 3. Define the list using the "
", "
- " and "
- " tags create.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
HTML list (List) can organize several related pieces of content to make the content look more organized. Within lists you can place text, images, links, etc. You can also define a list within another list (nested lists).
HTML provides us with three different forms of lists:
- Ordered list, use
- tag
- Unordered list , use
- tag
- to define the list, use
- tag
1. Ordered list
In HTML, the
- tag is used to represent an ordered list. The content in an ordered list has a sequence, such as a series of steps in a recipe. These steps need to be completed in order. In this case, an ordered list can be used.
- tags:
- is the abbreviation of order list, which means an ordered list. It can number each item in the list, starting from the number 1 by default.
- is the abbreviation of list item, which represents each item in the list. The number of
- in
- indicates how many pieces of content there are. List items can contain text, images, links, etc., or even another list.
Note that
- is generally used in conjunction with
- and will not appear alone, and it is not recommended to use other tags other than
- directly in
- .
- tag to represent each item in the list, but the contents in the unordered list are not in order. For example, the types of breakfast do not need to indicate the order, then an unordered list can be used.
Let’s look at a simple example:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HTML无序列表</title> </head> <body> <p>早餐的种类:</p> <ul> <li>鸡蛋</li> <li>牛奶</li> <li>面包</li> <li>生菜</li> </ul> </body> </html>
Copy after login<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>HTML无序列表</title> </head> <body> <p>早餐的种类:</p> <ul> <li>鸡蛋</li> <li>牛奶</li> <li>面包</li> <li>生菜</li> </ul> </body> </html>
Copy after login浏览器运行结果如图所示:
无序列表需要使用
- 和
- 标签:
- 是 unordered list 的简称,表示无序列表。
- 和
- 一样,都表示列表中的每一项。默认情况下,无序列表的每一项都使用
●
符号表示。
- 中的
注意,
- 一般和
- 配合使用,不会单独出现,而且不建议在
- 中直接使用除
- 之外的其他标签。
3. 定义列表
在 HTML 中,
- 标签用于创建定义列表。定义列表由标题(术语)和描述两部分组成,描述是对标题的解释和说明,标题是对描述的总结和提炼。
- 和
- 标签:
- 是 definition list 的简称,表示定义列表。
- 是 definition term 的简称,表示定义术语,也就是我们说的标题。
- 是 definition description 的简称,表示定义描述 。
可以认为
- 定义了一个概念(术语),
- 用来对概念(术语)进行解释。
注意,
- 和
- 是同级标签,它们都是
- 的子标签。一般情况下,每个
- 搭配一个
- ,一个
- 可以包含多对
- 和
- 。
我们来看一个简单的例子:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HTML定义列表</title> </head> <body> <dl> <dt>HTML</dt> <dd>HTML 是一种专门用来开发网页的标记语言,您可以转到《<a href="http://www.php.cn/course/list/11.html" target="_blank">HTML教程</a>》了解更多。</dd> <dt>CSS</dt> <dd>CSS 层叠样式表可以控制 HTML 文档的显示样式,用来美化网页,您可以转到《<a href="https://www.php.cn/course/list/12.html" target="_blank">CSS教程</a>》了解更多。</dd> <dt>JavaScript</dt> <dd>JavaScript 简称 JS,是一种用来开发网站(包括前端和后台)的脚本编程语言,您可以转到《<a href="https://www.php.cn/course/list/2.html" target="_blank">JS教程</a>》了解更多。</dd> </dl> </body> </html>
Copy after login - 和
- 虽然是同级标签,但是它们的默认样式不同,
- 带有一段缩进,而
- 顶格显示,这样层次更加分明。
4. 总结
列表分类 说明 有序列表 - 表示有序列表,
- 表示列表中的每一项,默认使用阿拉伯数字编号。
无序列表 - 表示无序列表,
- 表示列表中的每一项,默认使用
●
符号作为作为每一项的标记。
定义列表 - 表示定义列表,
- 表示定义术语、
- 表示定义描述。一般情况下,每个
- 搭配一个
- ,一个
- 可以包含多对
- 和
- 。
推荐教程:《html视频教程》
定义列表具体语法格式如下:<dl> <dt>标题1<dt> <dd>描述文本2<dd> <dt>标题2<dt> <dd>描述文本2<dd> <dt>标题3<dt> <dd>描述文本3<dd> </dl>
Copy after login定义列表需要使用
- 、
- 之外的其他标签。
- 一样,都表示列表中的每一项。默认情况下,无序列表的每一项都使用
- 标签:
2. Unordered list
HTML uses the
- tag to represent an unordered list. Unordered lists are similar to ordered lists, both use the
- tag to represent each item in the list, but the contents in the unordered list are not in order. For example, the types of breakfast do not need to indicate the order, then an unordered list can be used.
Let’s look at a simple example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HTML有序列表</title> </head> <body> <p>煮米饭的步骤:</p> <ol> <li>将水煮沸</li> <li>加入一勺米</li> <li>搅拌均匀</li> <li>继续煮10分钟</li> </ol> </body> </html>
Copy after loginOrdered lists require the use of
- and
The above is the detailed content of HTML provides several list modes. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
