HTML and CSS Reference
In-Depth Information
label
This attribute contains a short label that might be more appealing to use when the
selection list is rendered as a hierarchy due to the presence of an
optgroup
element.
selected
This attribute indicates that the associated item is the default selection. If this
attribute is not included, the first item in the selection list is the default. If the
select
element enclosing the
option
elements has the
multiple
attribute, the
selected
attribute
might occur in multiple entries. Otherwise, it should occur in only one entry. Under
XHTML, the value of the
selected
attribute must be set to
selected
.
value
This attribute indicates the value to be included with the form result when the item
is selected.
Example
<p>
Which is your favorite dog?:
<select>
<option value="Scottie">
Angus"
</option>
<option value="Mini Schnauzer" selected>
Tucker
</option>
<option value="Australian Shepard">
Sabrina
</option>
<option value="German Shepard">
Lucky
</option>
</select>
</p>
Compatibility
HTML 2, 3.2. 4, 4.01, 5
XHTML 1.0, 1.1, Basic
Firefox 1+, Internet Explorer 2+,
Netscape 1+, Opera 2.1+, Safari 1+
Notes
• Under HTML specifications, the closing tag for
<option>
is optional. However, for
XHTML compatibility, the closing tag
</option>
is required.
• This element should occur only within the context of a
select
element.
• The HTML 2.0 and 3.2 specifications define only the
selected
and
value
attributes
for this element.
<output> (Form Output)
This HTML5 block element defines a region that will be used to display output from some
calculation or form control.
HTML5 Standard Syntax
<output
accesskey="spaced list of accelerator key(s)"
class="class name(s)"
contenteditable="true | false | inherit"
contextmenu="id of menu"
data-X="user-defined data"
dir="ltr | rtl"
draggable="true | false | auto"
for="list of spaced id values of related elements"