HTML Aspect: choose | Envato Tuts+

The HTML choose ingredient is the basic dropdown most frequently seen in kinds. It permits customers to pick one thing from a set of choices. A number of choices will be chosen however customers are most frequently required to decide on one possibility per choose subject.
Examples
Syntax
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 |
A choose ingredient with the a number of attribute enabled (true) permits for a number of choices to submit with a kind submission.
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 |
Outcome
Browser Help
The choose ingredient is supported in all trendy browsers. Learn extra on caniuse.com.
Browsers show choose parts in another way, relying on their rendering engine. Check out this instance which exhibits the identical choose ingredient in Google Chrome (powered by Blink), Firefox (powered by Quantum), and Safari (powered by WebKit).
All browsers listed below are on MacOS
Attributes
A choose ingredient helps World Attributes in HTML. World Attributes are widespread to all HTML parts and can be utilized on all of them (although they might not have a lot of an impact on a few of them).
Along with international attributes the choose ingredient has a bunch of different attributes:
- autocomplete: Hit for a kind to autofill.
- disabled: Whether or not or not the shape management is disabled.
- kind: Associates the choose with a kind ingredient.
- a number of: Whether or not or to not permit a number of values.
- title: The title of the ingredient to make use of for kind submissions or by way of the shape.parts API.
- required: Whether or not the choose is required for kind submission.
- dimension: Measurement of the choose.
Content material
The choose ingredient helps zero or extra possibility, optgroup, and script-supporting parts.
If choosing a price is elective, you would possibly wish to embrace an empty
As of Chrome 119 and Safari 17, it’s additionally attainable to incorporate
parts to divide up your
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 |
Right here’s how that appears 👆
Right here’s a dwell demo, however for those who’re unable to see the
parts in your browser, strive Safari Know-how Preview.
- The
- The