Can a list be an element?

  • : The List Item element
  • The

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

        Content categoriesPermitted contentTag omissionPermitted parentsImplicit ARIA rolePermitted ARIA rolesDOM interface
        None.
        Flow content.
        The end tag can be omitted if the list item is immediately followed by another
      • element, or if there is no more content in its parent element.
      • An
          ,
            , or element. Though not a conforming usage, the obsolete can also be a parent.
        listitem when child of an ol, ul or menu
        menuitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem
        HTMLLIElement
  • 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. The value attribute has no meaning for unordered lists [
        ] or for menus [].

        type

        This character attribute indicates the numbering type:

        • a: lowercase letters
        • A: uppercase letters
        • i: lowercase Roman numerals
        • I: uppercase Roman numerals
        • 1: numbers

        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

    first item second item third item

    Ordered list with a custom value

    third item fourth item fifth item

    Unordered list

    first item second item third item

    Specifications

    Specification
    HTML Standard [HTML]
    # the-li-element

    Browser compatibility

    BCD tables only load in the browser

    See also

    • Other list-related HTML Elements:
        ,
          , , and the obsolete ;
        1. CSS properties that may be specially useful to style the
        2. element:
          • the list-style property, to choose the way the ordinal is displayed,
          • CSS counters, to handle complex nested lists,
          • the margin property, to control the indent of the list item.

    Video liên quan

    Chủ Đề