Home > Web Front-end > Front-end Q&A > HTML provides several list modes

HTML provides several list modes

青灯夜游
Release: 2021-11-17 16:42:10
Original
7774 people have browsed it

HTML provides 3 list modes: 1. Ordered list, created using "

    " and "
  1. " 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.

HTML provides several list modes

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
    1. tag
    2. 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.

        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 login

        HTML provides several list modes

        Ordered lists require the use of

          and
        1. tags:

            1. 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.
            2. is the abbreviation of list item, which represents each item in the list. The number of
            3. 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
          1. and will not appear alone, and it is not recommended to use other tags other than
          2. directly in
              .

              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>
                    <ul>
                        <li>鸡蛋</li>
                        <li>牛奶</li>
                        <li>面包</li>
                        <li>生菜</li>
                    </ul>
                </body>
                </html>
                Copy after login
                Copy after login

                浏览器运行结果如图所示:

                HTML provides several list modes

                无序列表需要使用

                • 标签:

                    • 是 unordered list 的简称,表示无序列表。
                        1. 中的
                        2. 一样,都表示列表中的每一项。默认情况下,无序列表的每一项都使用符号表示。

                      注意,

                        一般和
                      • 配合使用,不会单独出现,而且不建议在
                          中直接使用除
                        • 之外的其他标签。

                          3. 定义列表

                          在 HTML 中,

                          标签用于创建定义列表。定义列表由标题(术语)和描述两部分组成,描述是对标题的解释和说明,标题是对描述的总结和提炼。

                          定义列表具体语法格式如下:

                          <dl>
                              <dt>标题1<dt>
                              <dd>描述文本2<dd>
                              <dt>标题2<dt>
                              <dd>描述文本2<dd>
                              <dt>标题3<dt>
                              <dd>描述文本3<dd>
                          </dl>
                          Copy after login

                          定义列表需要使用

                          标签:

                          • 是 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

                          HTML provides several list modes

                          虽然是同级标签,但是它们的默认样式不同,
                          带有一段缩进,而
                          顶格显示,这样层次更加分明。

                          4. 总结

                          列表分类 说明
                          有序列表
                            表示有序列表,
                          1. 表示列表中的每一项,默认使用阿拉伯数字编号。
                          无序列表
                            表示无序列表,
                          • 表示列表中的每一项,默认使用符号作为作为每一项的标记。
                          定义列表
                          表示定义列表,
                          表示定义术语、
                          表示定义描述。一般情况下,每个
                          搭配一个
                          ,一个
                          可以包含多对

                          推荐教程:《html视频教程

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template