HTML <label> Tag
Description
The <label>
HTML element establishes a connection between a certain label, which is usually the text, and a form element ( <input>
, <select>
, <textarea>
). Such a relationship is necessary in order to change the values of form elements when the mouse clicks on the text. In addition, using <label>
you can set keyboard shortcuts and switch to the active element like links.
Properties
- Permitted Parents
- Any element that accepts phrasing content
- Content
- Inline and text
- Start/End Tags
- Start tag: required, End tag: required
Example
<form>
<label for="male">Male</label>
<input type="radio" name="sex" id="male" />
<label for="female">Female</label>
<input type="radio" name="sex" id="female" />
</form>
Attributes
Attribute | Definition |
---|---|
for | Specifies the input control that this label is for. This value must be the same as the value in the input control's "id" attribute. |
Global Attributes
The <label>
tag also supports the Global Attributes in HTML5
Event Attributes
The <label>
tag also supports the Event Attributes in HTML5
Browser Support
Desktop | |||||
Yes | Yes | Yes | Yes | Yes | Yes |
Tablets / Mobile | |||||
![]() |
|||||
Yes | Yes | Yes | Yes | Yes | Yes |
Last updated by CSSPortal on: 6th December 2019
HTML Tags
- a
- abbr
- address
- area
- article
- aside
- audio
- b
- base
- bdi
- bdo
- blockquote
- body
- br
- button
- canvas
- caption
- cite
- code
- col
- colgroup
- comment
- datalist
- dd
- del
- details
- dfn
- dialog
- div
- dl
- doctype
- dt
- em
- embed
- fieldset
- figcaption
- figure
- footer
- form
- h1
- h2
- h3
- h4
- h5
- h6
- head
- header
- hr
- html
- i
- iframe
- img
- input
- ins
- kbd
- keygen
- label
- legend
- li
- link
- map
- mark
- menu
- meta
- meter
- nav
- noscript
- object
- ol
- optgroup
- option
- output
- p
- param
- picture
- pre
- progress
- q
- rp
- rt
- ruby
- s
- samp
- script
- section
- select
- small
- source
- span
- strong
- style
- sub
- summary
- sup
- table
- tbody
- td
- textarea
- tfoot
- th
- thead
- time
- title
- tr
- track
- u
- ul
- var
- video
- wbr