HTML | <option> label Attribute

The HTML option label Attribute is used to specify the text value which represents the shorted label for option. The shortest version will be displayed in the drop-down list.

Syntax:

<option label="text">

Attribute Values: It contains single value text which specify the shorter version for an option.

Below example illustrates the use of label attribute for an option element.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
  
<head
    <title>
        HTML option label attribute
    </title
      
    <style
        body { 
            text-align:center; 
        
        h1 { 
            color:green; 
        
    </style
</head
  
<body
    <h1>GeeksforGeeks</h1
      
    <h2>HTML option label Attribute</h2
      
    <select
        <option>Choose an option</option
        <option label="HTML">HTML Language</option
        <option label="JAVA">JAVA Programming</option
        <option label="C++">C++ Programming</option
        <option label="PHP">PHP Programming</option
        <option label="PERL">PERL Programming</option
    </select
</body
  
</html>             

chevron_right


Output:

Supported Browsers: The browsers supported by HTML <option> label attribute are listed below:

  • Google Chrome
  • Internet Explorer 8.0
  • Safari
  • Opera


My Personal Notes arrow_drop_up


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.