• : The List Item element - HTML: HyperText Markup Language | MDN (original) (raw)
  • Baseline

    Widely available

    The <li> HTML element is used to represent an item in a list. It must be contained in a parent element: an ordered list (

      ), an unordered list (), or a menu (). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.

      Try it

      <p>Apollo astronauts:</p>
      
      <ul>
        <li>Neil Armstrong</li>
        <li>Alan Bean</li>
        <li>Peter Conrad</li>
        <li>Edgar Mitchell</li>
        <li>Alan Shepard</li>
      </ul>
      
      p,
      li {
        font:
          1rem "Fira Sans",
          sans-serif;
      }
      
      p {
        font-weight: bold;
      }
      

      Attributes

      This element includes the global attributes.

      value

      This integer attribute indicates the current ordinal value of the list item as defined by the

        element. The only allowed value for this attribute is a number, even if the list is displayed with Roman numerals or letters. List items that follow this one continue numbering from the value set. This attribute has no meaning for unordered lists () or for menus ().

        type Deprecated

        This character attribute indicates the numbering type:

        This type overrides the one used by its parent

          element, if any.

          **Note:**This attribute has been deprecated; use the CSS list-style-type property instead.

          Examples

          For more detailed examples, see the

            and pages.

            Ordered list

            <ol>
              <li>first item</li>
              <li>second item</li>
              <li>third item</li>
            </ol>
            

            Result

            Ordered list with a custom value

            <ol type="I">
              <li value="3">third item</li>
              <li>fourth item</li>
              <li>fifth item</li>
            </ol>
            

            Result

            Unordered list

            <ul>
              <li>first item</li>
              <li>second item</li>
              <li>third item</li>
            </ul>
            

            Result

            Technical summary

            Content categories None.
            Permitted content Flow content.
            Tag omission The end tag can be omitted if the list item is immediately followed by another
          1. element, or if there is no more content in its parent element.
          2. Permitted parents An
              ,
                , or element. Though not a conforming usage, the obsolete can also be a parent.
                Implicit ARIA role listitem when child of anol, ul ormenu
                Permitted ARIA roles menuitem,menuitemcheckbox,menuitemradio, option,none, presentation,radio, separator,tab, treeitem
                DOM interface HTMLLIElement

                Specifications

                Specification
                HTML # the-li-element

                Browser compatibility

                See also