html
  1. html-li-tag

HTML <li> Tag

The HTML <li> tag defines a list item and is used within an ordered or unordered list <ol> or <ul>.

Syntax

<ol>
  <li>...</li>
  <li>...</li>
  <li>...</li>
</ol>

<ul>
  <li>...</li>
  <li>...</li>
  <li>...</li>
</ul>

Example

<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ol>

<ul>
  <li>Apple</li>
  <li>Banana</li>
  <li>Cherry</li>
</ul>
Try Playground

Explanation

The HTML <li> tag is used to create a list item within an ordered <ol> or unordered <ul> list. It is a block-level element, meaning it takes up the entire width of its container.

Each item must be wrapped with the <li> tag. The ordered list will automatically increment numbers, while an unordered list will use bullets by default.

Use

The HTML <li> tag is used for creating lists of items. Using ordered lists (<ol>) allows you to display items in a numbered format, while unordered lists (<ul>) display items with bullet points.

This <li> tag is used in combination with <ul> and <ol> tags.

Important Points

  • The HTML <li> tag must be used within an ordered or unordered list (<ol> or <ul>).
  • The list items should be enclosed within the <li> tag.
  • The <li> tag is used to define a list item.

Summary

The HTML <li> tag is used to create a list item within an ordered or unordered list (<ol> or <ul>). Each list item should be enclosed within an <li> tag. This tag is used in combination with the <ul> and <ol> tags.

Published on: