Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML and options. Tags


May 04, 2021 HTML Reference Manual


Table of contents


HTML and options. Tags

The label is used to define the items contained in the elements of the element of the .lt;select>, slt;optgroup> or the .lt;datalist>

The label can represent a list of menu items and other items in pop-ups in HTML documents.

Create a selection list with 4 options:

<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>

Try it out . . .

Browser support

HTML and options. Tags HTML and options. Tags HTML and options. Tags HTML and options. Tags HTML and options. Tags

Most mainstream browsers support the hashtag.


Label definition and instructions for use

The label defines an option (an entry) in the drop-down list.

The contents of the label are used as either as an element of the .lt;select> or as a .lt;datalist.gt;


Tips and comments

Note: The label can be used without any attributes, but you typically need to use the value property, which indicates what was sent to the server.

Note: Use this label with the select element, otherwise it is meaningless.

Tip: If there are many list options, you can combine them using the hashtag.


Property

属性 描述
disabled disabled 规定此选项应在首次加载时被禁用。
label text 定义当使用 <optgroup> 时所使用的标注。
selected selected 规定选项(在首次显示在列表中时)表现为选中状态。
value text 定义送往服务器的选项值。


Global properties

The label supports global properties and views the full property sheet HTML global properties.


The event property

The label supports all HTML event properties.