# HTML value Attribute

HTMLWeb DevelopmentFront End Technology

#### Kickstart HTML, CSS and PHP: Build a Responsive Website

Featured

59 Lectures 8.5 hours

#### Web Design for Beginners: Build Websites in HTML & CSS 2022

68 Lectures 8 hours

#### Complete HTML/CSS Course 2022

Featured

47 Lectures 12.5 hours

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

Live Demo

<!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>
Updated on 30-Jul-2019 22:30:26