A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-option-label-attribute/ below:

HTML | <option> label Attribute

HTML | <option> label Attribute

Last Updated : 28 Jul, 2022

 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: 

html
<!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>             

Output:

  

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



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4