search
HomeWeb Front-endHTML TutorialWhat is the HTML li tag for? Introduction to HTML li tag usage and attributes

What is the HTML li tag for? The usage and attributes of the HTML li tag are introduced here. This article tells you the definition and attribute introduction of the HTML li tag, and how to remove the default dot style in the unordered list from the html li tag.

Definition and usage of HTML li tag:

  • tag defines list items.

  • The tag (full name is list item) is an element tag in the HTML language. Belongs to list tag. Starting with
  • , the
  • tag can be used in ordered lists (
      ) and unordered lists (
      ).

      HTML

    • tag usage example:
    • <ol>
         <li>Coffee</li>
         <li>Tea</li>
         <li>Milk</li>
      </ol>
       <ul>
         <li>Coffee</li>
         <li>Tea</li>
         <li>Milk</li>
      </ul>

      HTML li tag attributes:

      What is the HTML li tag for? Introduction to HTML li tag usage and attributesHTML li tag usage details:

      The unordered list is a list of items [1]. This column of items is marked with bold dots (typical small black circles). The unordered list starts with the

        tag. Each list item begins with
      • . Example:
        <ul>
        <li>Coffee</li>
        <li>Milk</li>
        </ul>

        The browser displays as follows:

        ·Coffee

        ·Milk

        Paragraphs, line breaks, pictures, links and Other lists and more.

        An ordered list is also a list of items, and the list items are marked with numbers. The ordered list starts with the

          tag. Each list item begins with a
        1. tag. Example:
          <ol>
          <li>Coffee</li>
          <li>Milk</li>
          </ol>

          The browser displays as follows:

          1.Coffee

          2.Milk

          Paragraphs, line breaks, pictures, Links and other lists and more.

          How to use the HTML li tag to click on small dots in an unordered list:

          First, let’s take a look at the problems that arise when we use list tags.

          <ul>
          <li>1</li><li>2</li><li>3</li><li>4</li><li>5</li>
          </ul>

          We found that a small black dot appeared. Because we are using unordered list tags. So how do you get rid of these dots?

          Let’s see how to solve the problem. First open notepad or other html editor. I use editplus. Create a new html file

          and add the following code to the source code:

          ul li{
          list-style: none;
          }

          This will remove the default style. Of course, you can also write the style directly in the tag, but I recommend everyone to use this method to make the code easier to maintain later.

          There is a more intuitive way:


          <html>
            <head>
            <style>
             ul,  li{display:block; position:relative;}
             li{float:left; margin:auto 10px; list-style:none; height:30px; line-height:30px;}
             .cle{clear:both;}
             </style>
            </head>
          <body>
            <ul>
             <li><a href = "
          http://www.baidu.com
          ">百度</a></li>
            <li><a href = "
          http://www.sina.com.cn
          ">新浪</a></li>
             <li><a href = "
          http://www.163.com
          ">网易</a></li>
             <li><a href = "
          http://www.qq.com
          ">腾讯</a></li>
             <li><a href = "
          http://www.php.cn
          ">PHP中文网</a></li>
             <li><a href = "
          http://www.google.com.hk
          ">谷歌</a></li>
           <div class="cle"></div>
            </ul>
          </body>
          </html>

          The difference between HTML and XHTML

          In HTML 4.01, the "type" and "value" attributes of the li element are deprecated.

          In XHTML 1.0 Strict DTD, the "type" and "value" attributes of the li element are not supported.

          【Related Recommendations】

          How to set the border attribute of html5? Introduction to the border attribute in html5 table

          ##Introduction to the usage and attributes of the new form element keygen tag in htm5


  • The above is the detailed content of What is the HTML li tag for? Introduction to HTML li tag usage and attributes. For more information, please follow other related articles on the PHP Chinese website!

    Statement
    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
    HTML超文本标记语言--超在那里?(文档分析)HTML超文本标记语言--超在那里?(文档分析)Aug 02, 2022 pm 06:04 PM

    本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

    li是什么元素li是什么元素Aug 03, 2023 am 11:19 AM

    li是HTML标记语言中的一个元素,用于创建列表。li代表列表项,它是ul或ol的子元素,li标签的作用是定义列表中的每个项目。在HTML中,li元素通常与ul或ol元素配合使用来创建有序或无序列表,无序列表使用ul元素,列表项用li元素表示,而有序列表则使用ol元素,同样也用li元素表示。

    web前端笔试题库之HTML篇web前端笔试题库之HTML篇Apr 21, 2022 am 11:56 AM

    总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

    html中li是什么html中li是什么Nov 19, 2021 pm 03:31 PM

    在html中,li的英文全称为“list item”,意思为“列表项”,是一个定义列表项目的元素标签,语法“<li>列表项内容</li>”;“<li>”标签可用在有序列表 “<ol>”和无序列表“<ul>”中。

    HTML5中画布标签是什么HTML5中画布标签是什么May 18, 2022 pm 04:55 PM

    HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

    总结HTML中a标签的使用方法及跳转方式总结HTML中a标签的使用方法及跳转方式Aug 05, 2022 am 09:18 AM

    本文给大家总结介绍a标签使用方法和跳转方式,希望对大家有所帮助!

    html5废弃了哪个列表标签html5废弃了哪个列表标签Jun 01, 2022 pm 06:32 PM

    html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

    html中document是什么html中document是什么Jun 17, 2022 pm 04:18 PM

    在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

    See all articles

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    Repo: How To Revive Teammates
    1 months agoBy尊渡假赌尊渡假赌尊渡假赌
    Hello Kitty Island Adventure: How To Get Giant Seeds
    4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Atom editor mac version download

    Atom editor mac version download

    The most popular open source editor

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    Powerful PHP integrated development environment

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Dreamweaver Mac version

    Dreamweaver Mac version

    Visual web development tools