Introduction
<select>
is a form control element that allows users to select an option from a list of options. It is used to create a drop-down list. <option>
is a child element of <select>
, which represents an option in a drop-down list.
Example
1 | <select id="my_select"> |
Default value
You can set default value to a select by adding selected
to the option element.
1 | <select id="my_select"> |
Use ul/li to create a select list
Its 2024 now, I still can’t set styles to option
like padding
and margin
. The only way to create a custom select list is to use ul
and li
elements.
1 | <ul id="my_select"> |
Reference
https://stackoverflow.com/a/22681234/1487475
未完,待续。。。