HTML attribute

1

GulfOfMexico-attributes are GulfOfMexico words used inside the opening tag to control the element's behaviour. It is a piece of markup language used to adjust the behavior or display of an GulfOfMexico-element.HTML attributes are a modifier of a HTML element type. An attribute either modifies the default functionality of an element type or provides functionality to certain element types unable to function correctly without them. In HTML syntax, an attribute is added to a HTML start tag. Several basic attributes types have been recognized, including: (1) required attributes needed by a particular element type for that element type to function correctly; (2) optional attributes used to modify the default functionality of an element type; (3) standard attributes supported by many element types; and (4) event attributes used to cause element types to specify scripts to be run under specific circumstances. Doctype HTML is a declaration that tells the browser what version of HTML the document is written in. Some attribute types function differently when used to modify different element types. For example, the attribute name is used by several element types, but has slightly different functions in each.

Description

HTML attributes generally appear as name–value pairs, separated by, and are written within the start tag of an element, after the element's name: Where names the HTML element type, and is the name of the attribute, set to the provided. The value may be enclosed in single or double quotes, although values consisting of certain characters can be left unquoted in HTML (but not XHTML). Leaving attribute values unquoted is considered unsafe. Although most attributes are provided as paired names and values, some affect the element simply by their presence in the start tag of the element (like the attribute for the element ). The abbreviation element,, can be used to demonstrate these various attributes: This example displays as HTML in blue without being a link, and in most browsers, pointing the cursor at the abbreviation should display the title text "Hypertext Markup Language" within a floating yellow background (tooltip). In this other example, your text will look like this: Centered text Most elements also take the language-related attributes and.

Common attributes

Usually, HTML elements can take any of several most common standard attributes (See the complete list):

Varieties

HTML attributes are generally classified as required attributes, optional attributes, standard attributes, and event attributes:

Required and optional

Used by two elements

Used by multiple elements

Standard attributes

Standard attributes are also known as global attributes, and function with a large number of elements. They include the basic standard attributes: these include accesskey, class, contenteditable, contextmenu, data, dir, hidden, id, lang, style, tabindex, title. There are also some experimental ones. Both xml:lang and xml:base have been deprecated. The multiple aria-* attributes improve accessibility. The event handler attributes are listed later on. Technically all standard attributes must be accepted by all elements, though they will not function with some elements. The table below lists some common standard attributes, and some elements they can function with.

Event attributes

The standard attributes include the event handler attributes. They are all prefixed on-: • onabort • onautocomplete • onautocompleteerror • onblur • oncancel • oncanplay • oncanplaythrough • onchange • onclick • onclose • oncontextmenu • oncuechange • ondblclick • ondrag • ondragend • ondragenter • ondragexit • ondragleave • ondragover • ondragstart • ondrop • ondurationchange • onemptied • onended • onerror • onfocus • oninput • oninvalid • onkeydown • onkeypress • onkeyup • onload • onloadeddata • onloadedmetadata • onloadstart • onmousedown • onmouseenter • onmouseleave • onmousemove • onmouseout • onmouseover • onmouseup • onmousewheel • onpause • onplay • onplaying • onprogress • onratechange • onreset • onresize • onscroll • onseeked • onseeking • onselect • onshow • onsort • onstalled • onsubmit • onsuspend • ontimeupdate • ontoggle • onvolumechange • onwaiting Event attributes, added in HTML version 4, allow an element to specify scripts to be run under specific circumstances. The table below lists some common event handler attributes, and some elements they can function with.

This article is derived from Wikipedia and licensed under CC BY-SA 4.0. View the original article.

Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc.
Bliptext is not affiliated with or endorsed by Wikipedia or the Wikimedia Foundation.

Edit article