HTML | <select> size Attribute

The HTML size Attribute is used to specifies the number of visible options in a drop-down list.

Note: If the value of the size attribute is greater than 1 but lower that the number of options in a DropDown List. so the Browser will automatically add the scrollbar for specifying that there are more options to view.

Syntax:



<select size = "value"> option values...</select> 

Attribute Values: It contains a numeric value which specify the number of visible options in the drop-down list. It has a Default value which is 4.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>HTML select size Attribute</title>
</head>
  
<body>
    <h1 style="color: green;"
            GeeksforGeeks 
        </h1>
  
    <h2
            HTML select size Attribute 
        </h2>
    <p>Sorting Algorithms</p>
    <select size="3">
        <option value="merge">merge sort</option>
        <option value="bubble">bubble sort</option>
        <option value="selection">selection sort</option>
        <option value="quick">quick sort</option>
        <option value="insertion">insertion sort</option>
    </select>
</body>
  
</html>

chevron_right


Output:

Supported Browsers: The browser supported by HTML Select size Attribute are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.