CSS Portal

HTML <li> Tag

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The <li> element in HTML represents a list item. It is used to define an individual item within a list structure, such as an ordered list (<ol>) or an unordered list (<ul>). It can also appear inside a menu list (<menu>), though this is less common.

Each <li> element typically contains text, but it can also include other HTML elements such as links, images, paragraphs, or even nested lists, making it versatile for building complex list structures. When rendered by a browser, <li> elements are displayed with markers (like bullets for unordered lists or numbers for ordered lists) by default, though these can be customized or removed using CSS.

Key characteristics of <li>:

  • Hierarchy: <li> elements are always child elements of a list container. Placing them outside of a <ul>, <ol>, or <menu> is invalid HTML and may produce inconsistent rendering.
  • Nesting: Lists can be nested inside other lists by placing a <ul> or <ol> inside an <li> element. This is useful for creating sublists or multi-level menus.
  • Content flexibility: While typically used for simple text items, an <li> can contain almost any HTML content, such as images, links, forms, or block-level elements.
  • Display behavior: By default, <li> elements are block-level, meaning they occupy the full width available in the list container, stacking vertically.
  • Semantic meaning: The <li> tag provides semantic structure to a list, helping both browsers and assistive technologies understand the organization and purpose of the content.

Example:

<ul>
  <li>First item</li>
  <li>Second item
    <ul>
      <li>Subitem 1</li>
      <li>Subitem 2</li>
    </ul>
  </li>
  <li>Third item</li>
</ul>

In this example, the <li> elements define three main list items, with the second item containing a nested unordered list. The structure clearly communicates hierarchy and order to the browser and users.

Properties

Permitted Parents
An <ul>, <ol>, or <menu> element. Though not a conforming usage, the obsolete <dir> can also be a parent
Content
Block, inline and text
Start/End Tags
Start tag: required, End tag: required

Example

<ul>
<li>Mouse</li>
<li>Cat</li>
<li>Dog</li>
</ul>

Attributes

type
Specifies the type of bullet. Possible values:
  • A
  • a
  • I
  • i
  • 1
  • disc
  • square
  • circle
-Deprecated- Use CSS Instead
value
Specifies the number of the current list item.
-Deprecated-

Global Attributes

The <li> tag also supports the Global Attributes in HTML5

Event Attributes

The <li> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <li> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!