Related Articles

Related Articles

HTML | li Tag
  • Difficulty Level : Basic
  • Last Updated : 18 Jul, 2019

The <li> tag in HTML is used to define a 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.

Syntax:

<li> Item </li>

Attribute Value: The <li> tag contains two attributes type and value

Below examples illustrate the <li> element in HTML



Example-1: Using <li> with Ordered Lists

filter_none

edit
close

play_arrow

link
brightness_4
code

<html>
  
<head>
    <title> li tag</title>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
    <ol>
        <li>Geeks</li>
        <li>Sudo</li>
        <li>Gfg</li>
        <li>Gate</li>
        <li>Placement</li>
    </ol>
</body>
  
</html>

chevron_right


Output:

Example-2: Using <li> with Unordered Lists

filter_none

edit
close

play_arrow

link
brightness_4
code

<html>
  
<head>
    <title> li tag</title>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
    <ul>
        <li>Geeks</li>
        <li>Sudo</li>
        <li>Gfg</li>
        <li>Gate</li>
        <li>Placement</li>
    </ul>
</body>
  
</html>

chevron_right


Output:

Supported Browsers: The browser supported by <li> tag are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

full-stack-img




My Personal Notes arrow_drop_up
Recommended Articles
Page :