li HTML

HTML <li> Tag

The list items in an HTML Ordered and Unordered List start with the <li> tag. In an ordered list, all the list items are marked with numbers by default, while in an unordered list, all the list items are marked with bullets by default.

Example 1: Ordered List.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<body>
<h2>HTML Ordered List or Numbered List</h2>
<ol>
<li>Name</li>
<li>Age</li>
<li>Address</li>
</ol>
</body>
</html>
<!DOCTYPE html> <html> <body> <h2>HTML Ordered List or Numbered List</h2> <ol> <li>Name</li> <li>Age</li> <li>Address</li> </ol> </body> </html>
<!DOCTYPE html>
<html>
<body>
<h2>HTML Ordered List or Numbered List</h2>
<ol>
  <li>Name</li>
  <li>Age</li>
  <li>Address</li>
</ol>  
</body>
</html>

Explanation:

In the above example, we created an ordered or numbered list in HTML containing three items.

Example 2: Unordered List.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<body>
<h2>HTML Unordered List or Bulleted List</h2>
<ul>
<li>Name</li>
<li>Age</li>
<li>Address</li>
</ul>
</body>
</html>
<!DOCTYPE html> <html> <body> <h2>HTML Unordered List or Bulleted List</h2> <ul> <li>Name</li> <li>Age</li> <li>Address</li> </ul> </body> </html>
<!DOCTYPE html>
<html>
<body>
<h2>HTML Unordered List or Bulleted List</h2>
<ul>
  <li>Name</li>
  <li>Age</li>
  <li>Address</li>
</ul>  
</body>
</html>

Explanation:

In the above example, we created an unordered or bulleted list in HTML containing three items.

Global Attributes:

The HTML Global attributes are supported by the HTML <li> tag.

Event Attributes:

The HTML Event attributes are supported by the HTML <li> tag.

Supporting Browsers:

Chrome, IE, Firefox, Opera, and Safari.