Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <option> label Attribute

The label attribute on an <option> tag specifies a shorter version of the option‘s text content.

The label value will display instead of the longer text version.

Example

#

A label attribute on <option> elements.
The shorter label values are displayed rather than the longer country names.

<select>
  <option>-- Select Country --</option>
  <option value="1" label="USA">United States of America</option>
  <option value="2" label="UK">United Kingdom</option>
  <option value="3" label="UAE">United Arab Emirates</option>
</select>

Using label

The label attribute specifies a shorter version of the option text.

The label value will display instead of the content text.


Syntax

<option label="text">

Values

#

Value Description
text Shorter version of the option text.

Browser support

Here is when label support started for each browser:

Chrome
1.0 Sep 2008
Firefox
2.0 Oct 2006
IE/Edge
8.0 Mar 2009
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <option>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides