Content deleted Content added
Jon Kolbert (talk | contribs) m →Varieties: HTTP -> HTTPS for W3Schools using AWB |
Differentiate between "tag" and "element". |
||
Line 1:
{{Html series}}
The attributes are special words used inside the opening tag to control the
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 a large number of element types; and (4) ''event attributes'', used to cause element types to specify scripts to be run under specific circumstances.
Line 9:
HTML attributes generally appear as name-value pairs, separated by <code>=</code>, and are written within the start tag of an element, after the element's name:
:<source lang="html4strict"><
Where <code>
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<ref name="tagshtml">{{cite web|url=http://www.w3.org/History/19921103-hypertext/hypertext/WWW/MarkUp/Tags.html |title=Tags used in HTML |publisher=World Wide Web Consortium |date=November 3, 1992 |accessdate=November 16, 2008}}</ref> (like the <code>ismap</code> attribute for the <code>img</code> element<ref>{{cite web|url=http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html#adef-ismap|title=Objects, Images, and Applets in HTML documents |publisher=World Wide Web Consortium |date=December 24, 1999|accessdate=November 16, 2008}}</ref>).
Line 36:
==Required and optional==
===Used by one
* {{MDNHTMLRef|applet}}: {{MDNHTMLRef|applet|code}}, {{MDNHTMLRef|applet|object}}
* {{MDNHTMLRef|area}}: {{MDNHTMLRef|area|nohref}}
Line 58:
* {{MDNHTMLRef|td}}: {{MDNHTMLRef|td|headers}}
===Used by two
* {{MDNHTMLRef|a}} and {{MDNHTMLRef|area}}:
** coords — coordinates of an {{MDNHTMLRef|area|coords|v=1}} or a {{MDNHTMLRef|link|coords|v=1}} within it.
Line 87:
** rows — number of visible rows in {{MDNHTMLRef|frameset|rows|v=1}} or {{MDNHTMLRef|textarea|rows|v=1}} ''(some variation)''
* {{MDNHTMLRef|img}} and {{MDNHTMLRef|object}}:
** usemap — specifies name of a map
* {{MDNHTMLRef|input}} and {{MDNHTMLRef|textarea}}:
** readonly — specifies read-only text for {{MDNHTMLRef|input|readonly|v=1}} and {{MDNHTMLRef|textarea|readonly|v=1}}.
Line 102:
** scope — no effect on normal browser display, but marks a table {{MDNHTMLRef|td|scope|t=cell}} or {{MDNHTMLRef|td|scope|t=header}} as a logical header for other cells. Values: col, colgroup, row, rowgroup.
===Used by multiple
* '''align''' — {{MDNHTMLRef|applet|align|v=1}}, {{MDNHTMLRef|col|align|v=1}}, {{MDNHTMLRef|colgroup|align|v=1}}, {{MDNHTMLRef|object|align|v=1}}, {{MDNHTMLRef|tbody|align|v=1}}, {{MDNHTMLRef|td|align|v=1}}, {{MDNHTMLRef|tfoot|align|v=1}}, {{MDNHTMLRef|th|align|v=1}}, {{MDNHTMLRef|thead|align|v=1}}
:*align also deprecated in {{MDNHTMLRef|caption|align|v=1}}, {{MDNHTMLRef|div|align|v=1}}, {{MDNHTMLRef|h1|align|v=1}} to {{MDNHTMLRef|h6|align|v=1}}, {{MDNHTMLRef|hr|align|v=1}}, {{MDNHTMLRef|iframe|align|v=1}}, {{MDNHTMLRef|img|align|v=1}}, {{MDNHTMLRef|input|align|v=1}}, {{MDNHTMLRef|legend|align|v=1}}, {{MDNHTMLRef|p|align|v=1}}, {{MDNHTMLRef|table|align|v=1}}
Line 132:
''Standard attributes'' are also known as ''global attributes'', and function with a large number of elements.<ref name="globalattribute">{{cite web|url=https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes |title=Global attributes - HTML (HyperText Markup Language) MDN |date=|accessdate=2015-02-12}}</ref> 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.<ref name="globalattribute"/> 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.<ref name="HTMLReference">{{cite web | url=https://developer.mozilla.org/en-US/docs/Web/HTML/Reference | title=HTML reference - HTML (HyperText Markup Language) MDN | accessdate=13 February 2015}}</ref> The table below lists some common standard attributes, and some
{| class="wikitable sortable"
!Element
!id
!class
Line 1,053:
The standard attributes include the ''event handler attributes''. They are all prefixed on-. They are: ''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.''<ref name="globalattribute"/>
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
{| class="wikitable sortable" style="font-size:80%;"
|-
!Element
!At
!At
|