HTML | <li> value Attribute

The <li> value attribute in HTML is used to specify the initial value of the list item. It is only applicable on the ordered list.

Syntax:

<li value="number">list items </li>

Attribute Value: This attribute contains single value number which is used to specify the value of the list items.

Example 1: This example uses <li> value attribute to create list of items.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>
            HTML list item value Attribute
        </title>
    </head>
      
    <body>
        <center>
            <h1 style = "color: green;">
                GeeksforGeeks
            </h1>
              
            <h2>
                HTML list item value Attribute
            </h2>
              
            <p>Sorting Algorithms</p>
        </center>
          
        <ol style="margin-left:42%">
            <li value="50">Merge sort</li>
            <li>Quick sort</li>
            <li>Insertion sort</li>
        </ol>
          
    </body>
</html>                    

chevron_right


Output:
listvalue



Example 2: This example uses <li> value attribute to create list of items.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>
            HTML li value Attribute
        </title>
    </head>
      
    <body>
        <h1 style = "color: green;">
            GeeksforGeeks
        </h1>
          
        <h2>
            HTML li value Attribute
        </h2>
          
        <p>Sorting Algorithms</p>
          
        <ol type = "A">
            <li value="6">Merge sort</li>
            <li>Quick sort</li>
            <li>Insertion sort</li>
        </ol>
    </body>
</html>                    

chevron_right


Output:
listvalue

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

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


My Personal Notes arrow_drop_up


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.




Article Tags :
Practice Tags :


Be the First to upvote.


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