label attribute — a user-visible name
The label attribute names an optgroup group, an option, or a track. It is not a global attribute or a replacement for the label element. An option’s label and its submitted form value are separate concepts.
CKTIS / HTML
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
The label attribute names an optgroup group, an option, or a track. It is not a global attribute or a replacement for the label element. An option’s label and its submitted form value are separate concepts.
The `lang` attribute declares the natural language of an element and its contents so browsers and assistive technologies can select appropriate pronunciation and typographic rules.
The `list` attribute connects an `input` to a `datalist` containing suggested values. It does not restrict the entered value to those suggestions.
The loading attribute controls whether resource loading can be deferred based on an element's position relative to the viewport. It accepts lazy or eager; omission and invalid values mean eager. The standard defines it for img, iframe, audio, and video.
The boolean loop attribute on audio and video enables repetition: media returns to the beginning when it reaches the end. It does not start playback by itself.
The low attribute on meter defines the upper boundary of the low measurement range. It sets neither the minimum nor the current value; optimum determines what low values mean.
The max attribute sets the upper bound for selected input types, a meter scale, or task progress. Its value format, defaults, and the consequences of exceeding the bound depend on the element.
The maxlength attribute limits text length in textarea and selected input types. It counts UTF-16 code units rather than user-perceived characters. It does not limit a numeric value or automatically truncate text assigned by a script.
The media attribute contains a media query list that determines when styles apply, a source is considered, or theme-color metadata is used. Its exact behavior depends on the element: link, style, source, or meta.
The method attribute on form selects get, post, or dialog. It determines how form data is submitted, or closes a dialog instead of making a network request.
The min attribute sets the lower bound for supported input types and for a meter's range. It does not specify a minimum text length.
The minlength attribute sets the minimum length of a nonempty user-entered value in a textarea or supported input field. It does not make the field mandatory; use required for that.
The boolean `multiple` attribute permits multiple options in `select`, multiple addresses in an `email` input, or multiple files in a `file` input. Its presence controls the behavior, not the text of its value.
The muted boolean attribute specifies default muting for audio and video elements. The defaultMuted property reflects the attribute, whereas muted reads and changes current muting.
The `name` attribute supplies an element-specific name: a form-data key, navigation target name, image-map name, `details` group, slot name, or metadata name. It is not a global attribute or a replacement for `id`.
The boolean `nomodule` attribute on `script` prevents a classic script from executing in browsers that support both JavaScript modules and the attribute. It lets you supply a legacy version of your code alongside a module script.
The nonce attribute holds a textual cryptographic value used by Content Security Policy (CSP). The element.nonce property exposes it to scripts even when the browser hides the attribute value.
The boolean `novalidate` attribute on a `form` skips built-in constraint validation during submission. It does not remove field constraints or disable explicit calls to validation methods.
The onafterprint attribute on body sets a handler for the Window object's afterprint event. It can restore the interface after the printing procedure, but it does not confirm that the document was printed.
The onauxclick attribute assigns JavaScript code to the auxclick event, associated with clicking a non-primary pointing-device button. It can be used on all HTML elements.
onbeforeinput is an event-handler attribute for beforeinput, which concerns user editing of data. It lets JavaScript run before a change and cancel the default operation when the event is cancelable.
The global onbeforematch attribute contains JavaScript handling the beforematch event. It lets code react before the browser reveals an element with hidden="until-found" during find-in-page or fragment navigation.
The onbeforeprint attribute on body defines JavaScript code that handles the Window object's beforeprint event. It lets you prepare document content before printing; it does not start printing by itself.
The `onbeforetoggle` attribute sets a handler for `beforetoggle`. The event fires before a popover opens but not before every close. It also fires before dialog transitions initiated by methods such as `showModal()` or `close()`. Directly adding or removing a dialog’s `open` attribute does not fire the event. The handler can inspect the previous and intended states and cancel opening.