docs.rodeo

MDN Web Docs mirror

  • : The List Item element
  • {{HTMLSidebar}} 

    The <li> HTML element is used to represent an item in a list. It must be contained in a parent element: an ordered list ({{HTMLElement("ol")}} ), an unordered list ({{HTMLElement("ul")}} ), or a menu ({{HTMLElement("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.

    {{EmbedInteractiveExample("pages/tabbed/li.html", "tabbed-shorter")}} 

    Attributes

    This element includes the global attributes.

    Examples

    For more detailed examples, see the {{htmlelement("ol")}}  and {{htmlelement("ul")}}  pages.

    Ordered list

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

    Result

    {{EmbedLiveSample("Ordered_list")}} 

    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

    {{EmbedLiveSample("Ordered_list_with_a_custom_value")}} 

    Unordered list

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

    Result

    {{EmbedLiveSample("Unordered_list")}} 

    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 <li> element, or if there is no more content in its parent element.
    Permitted parents An `{{HTMLElement("ul")}}` , `{{HTMLElement("ol")}}` , or `{{HTMLElement("menu")}}`  element. Though not a conforming usage, the obsolete `{{HTMLElement("dir")}}`  can also be a parent.
    Implicit ARIA role listitem when child of an ol, ul or menu
    Permitted ARIA roles menuitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem
    DOM interface `{{domxref("HTMLLIElement")}}` 

    Specifications

    {{Specifications}} 

    Browser compatibility

    {{Compat}} 

    See also

    In this article

    View on MDN