
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML
The value attribute of the <li> element is used to set the value of the list item. Since the value is a number, it would be set only for the ol element in HTML i.e. the ordered list.
Following is the syntax −
<li value="num">
Above, num is the value of the list item in an ordered list.
Let us now see an example to implement the value attribute of the <li> element −
Example
<!DOCTYPE html> <html> <body> <h1>Subjects</h1> <p>Following are the subjects −</p> <ol> <li>Maths</li> <li>Science</li> <li>English</li> <li>French</li> </ol> <p>Remaining subjects −</p> <ol> <li value="5">Coffee</li> <li>Accounts</li> <li>Programming</li> <li>Networking</li> </ol> </body> </html>
Output
In the above example, we have set two unordered lists −
<p>Following are the subjects −</p> <ol> <li>Maths</li> <li>Science</li> <li>English</li> <li>French</li> </ol> <p>Remaining subjects −</p> <ol> <li value="5">Coffee</li> <li>Accounts</li> <li>Programming</li> <li>Networking</li> </ol>
One of them is not beginning from the default 1. We have set a different value using the value attribute −
<ol> <li value="5">Coffee</li> <li>Accounts</li> <li>Programming</li> <li>Networking</li> </ol>
- Related Articles
- HTML value Attribute
- HTML value Attribute
- HTML value Attribute
- HTML input value Attribute
- HTML option value Attribute
- HTML maxlength Attribute
- HTML wrap Attribute
- HTML checked Attribute
- HTML datetime Attribute
- HTML coords Attribute
- HTML hreflang Attribute
- HTML cite Attribute
- HTML cite Attribute
- HTML autocomplete Attribute
- HTML max Attribute

Advertisements