Skip to content
Related Articles

Related Articles

Improve Article

HTML | <li> value Attribute

  • Last Updated : 30 Apr, 2019

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.




<!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>                    

Output:
listvalue



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




<!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>                    

Output:
listvalue

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

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

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :