HTML | li Tag

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
  • Firefox
  • Opera
  • Internet Explorer
  • Apple Safari


My Personal Notes arrow_drop_up

Final Year Student Programming Enthusiast

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : MritunjayPathak



Article Tags :
Practice Tags :


2


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.