Home >
Web Front-end >
HTML Tutorial >
Detailed explanation of the usage of option and optgruop tags in html form option menu
Detailed explanation of the usage of option and optgruop tags in html form option menu
黄舟
Release: 2017-07-03 09:38:19
Original
5591 people have browsed it
Use the option tag to define each item in a
Use the value attribute to set a value for each option. When the user selects the option, the browser will send it to the server. If the value attribute is not specified, the value of the option will be set to the contents of the
coption value=dog>dog <option>dog
Copy after login
Both have the same value. The first one outputs the value set in the
selected attribute
By default, all options in multi-select
The HTML version of the selected attribute has no value. The XHTML version has the value selected=selected. If no option is explicitly pre-selected, the radio's
label attribute
Normally, when the element is displayed to the user, the content in the
Option menus in forms can be very long, making them difficult to display and use. In this case, it can be helpful to group some related options, and then present these groups to the user as a nested set of cascading menus.
tag (general browsers will simply display them as a scrolling menu), we cannot show readers this What the menu looks like. However, they may be very similar to the familiar drop-down menus, which are a common feature of most graphical user interfaces. When selected with the mouse or keyboard,
leads to one or more menus. For example, in our example of "state," there might be submenus labeled "Northeast" and "South," and each submenu will display a list of the states it contains. Unfortunately, the biggest obstacle of the
tag is that it cannot be nested, which limits there to only one layer of submenus. However, in future versions of XHTML, this limitation may be exceeded. Use the label attribute to define the title of an
Organize elements related to
The above is the detailed content of Detailed explanation of the usage of option and optgruop tags in html form option menu. For more information, please follow other related articles on the PHP Chinese website!
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn