HTML <li> Tag
The <li> tag in HTML is used to define the list item in an HTML document. It is used within an Ordered List <ol> or Unordered List <ul>. The <li> tag requires a starting and end tag.
Note: 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.
<li> List Items </li>
value: The value attribute is used to specify the starting number of the list item. The list item starts from this number and increments its value with every addition of items to it. The value attribute only works for the ordered lists i.e. <ol> tag.
Example 1: This example using <li> tag inside Ordered Lists.
Example 2: This example using <li> tag with Unordered Lists.
Example 3: This example using <li> tag with value attribute to create lists.
Applying Styles to <li> Tag: Some CSS properties can also be used to style the <li> elements that are: list-style, list-style-image, list-style-position, and list-style-type. These properties can be directly applied to the <li> element although, they are usually applied to the parent element.
- Google Chrome
- Internet Explorer