select size attribute
The size attribute on the select element:
- allows you to specify the number of options in the drop-down list to be shown to the user, starting with the first option
- size is a specific attribute → can be applied ONLY on the next HTML5 elements: input, select
- is an optional attribute
Note: select control displays:
- - 1 option by default;
- 4 options if multiple attribute is present;
- x options if size attribute is present, where x represents the value of the size attribute which must be a positive integer greater than 0;
Examples
<select | attribute | = | "value(s)" | > | ... | <⁄select> | example |
---|---|---|---|---|---|---|---|
7. | size | = | number | <size="3"> ... <⁄ > |
Video demonstration select size attribute
HTML5 select size attribute Tutorial
min | video details |
---|---|
00:00 | video tutorial: size attribute on select element |
00:05 | size attribute allows you to specify the number of options to be shown to the user from the drop-down list of options, starting with the first option |
00:14 | the select control displays: - the first option by default - the first 4 options if multiple attribute is present - the first x options if size attribute is present, where x represents the value of the size attribute (a positive integer greater than 0) |
00:29 | the first 4 options are displayed (shown) in the drop-down list (to see the rest of the options, use the vertical scrollbar) |
00:37 | size="3" → the first 3 options will be shown to the user from the drop-down list |
00:44 | size="9" → the first 9 options will be shown to the user from the drop-down list |