Content deleted Content added
HeyElliott (talk | contribs) |
HeyElliott (talk | contribs) Added archives, ce |
||
Line 35:
Usually, [[HTML element]]s can take any of several most common standard attributes ([[#Standard attributes|See the complete list]]):
* The '''<code>id</code>''' attribute provides a document-wide unique identifier for an element.<ref>However, multiple identifiers may apply to the same element; in particular an element may be inside another element, each having an identifier.</ref><ref>{{Cite web|url=https://www.w3schools.com/html/html_id.asp|title=HTML id|website=
* The '''<code>class</code>''' attribute provides a way of classifying similar elements. Multiple class names can be added by separating them with spaces.<ref>{{Cite web|url=https://www.w3schools.com/html/html_classes.asp|title=HTML Classes|website=
* The '''<code>style</code>''' attribute provides a way of applying element-specific style rules. Multiple [[CSS#Declaration block|style declarations]] can be added by separating them with semicolons and an optional space, where each declaration includes a CSS property name and a value separated by a colon and an optional space (Example: <code>style="color: red; text-align: center;"</code>).<ref>{{Cite web|url=https://www.w3schools.com/html/html_styles.asp|title=HTML Styles|website=
|title=CSS Syntax|website=
* The '''<code>title</code>''' attribute is used to attach subtextual explanation to an element. In most browsers this attribute is displayed as what is often referred to as a [[tooltip]].
Line 44:
HTML attributes are generally classified as '''required attributes''', '''optional attributes''', '''standard attributes''', and '''event attributes''':
*Usually the required and optional attributes modify specific HTML elements
*While the standard attributes can be applied to most HTML elements.<ref>{{cite web|url=https://www.w3schools.com/tags/ref_standardattributes.asp|title=HTML
*Event attributes, added in HTML version 4, allow an element to specify [[JavaScript|scripts]] to be run under specific circumstances.<ref>{{cite web|url=https://www.w3schools.com/tags/ref_eventattributes.asp|title=HTML
== Required and optional ==
Line 143:
== Standard attributes ==
''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) |website=MDN Web Docs |access-date=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) |website=MDN Web Docs | access-date=13 February 2015}}</ref> The table below lists some common standard attributes, and some elements they can function with.
{| class="wikitable sortable"
|