HTML li tag

HTML li stands for list item. <li> tag takes part in making lists. This tag can be used in ordered or unordered lists.

<ol>
  <li> Computer </li>
  <li> Laptop </li>
  <li> Tablet </li>
  <li> Chair</li>
 </ol>
</>
  1. Computer
  2. Laptop
  3. Tablet
  4. Chair

Tag Uses

Specific uses of <li> tag

as ordered lists

Ordered lists are used where the order of items is necessary.

For example, the directions or instructions in a recipe where the sequence of instructions is necessary.

Example

  1. Blend all ingredients together
  2. Add whipped cream and any other toppings you like.
Try </>

as unordered lists

The unordered lists are used where the order of items is not necessary.

For example, ingredients in a recipe.

Example

  • 2/3 cups of ice
  • 2/3 cups of milk
  • 2 tbsp raspberry syrup
  • 2 tbsp vanilla syrup
  • 2 scoops vanilla bean ice cream
Try </>

Tag omission

The end tag (</li>) may be omitted.

Global Attributes

All the global attributes are applicable on li element.

Tag Attributes

Attributes that are applicable to <li> tag
value

The value attribute of li tag represents the user visible content of list items.

<ol> <li value="chair"> </li> </ol>


Was this article helpful?