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.
html
<!DOCTYPE html> < html > < head > < title > HTML list item value Attribute </ title > </ head > < body > < center > < h1 style = "color: green;"> neveropen </ 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:
Example 2: This example uses <li> value attribute to create list of items.
html
<!DOCTYPE html> < html > < head > < title > HTML li value Attribute </ title > </ head > < body > < h1 style = "color: green;"> neveropen </ 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:
Supported Browsers: The browser supported by <li> value attribute are listed below:
- Apple Safari 4
- Google Chrome 1
- Edge 12
- Firefox 1
- Opera 12.1
- Internet Explorer 6