Global attributes

  • Revision slug: HTML/Global_attributes
  • Revision title: Global attributes
  • Revision id: 38540
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 192 words added, 2 words removed

Revision Content

WORK IN PROGRESS

HTML defines a few attributes that are common to all HTML elements.

accesskey
This attribute hints for the generation of a keyboard shortcut for the current element. This attribute consists on a space-separated list of characters (one single Unicode code point). The browser should use the first one that exists on the computer keyboard layout.
{{ HTMLVersionInline("4") }} In previous versions of HTML, only one character could be specified. Also it wasn't a global attribute and could be applied only to the {{ HTMLElement("a") }}, {{ HTMLElement("area") }}, {{ HTMLElement("button") }}, {{ HTMLElement("input") }}, {{ HTMLElement("label") }}, {{ HTMLElement("legend") }} and {{ HTMLElement("textarea") }}.
Normative document HTML5, section 8.5 ({{ HTMLVersionInline("4") }}: HTML4.01, section 17.11.2)
class
Lorem ipsum
contenteditable {{ HTMLVersionInline("5") }}
Lorem ipsum
contextmenu {{ HTMLVersionInline("5") }} {{ unimplemented_inline() }}
Lorem ipsum
dir
This enumerated attribute indicates the directionality of the element's text. It can have the following values:
  • ltr, which means left to right and is to be used for languages that are written from the left to the right (like English);
  • rtl, which means right to left and is to be used for languages that are written from the right to the left (like Arabic).

 

Usage notes:

  • This attribute can be overrided by the CSS properties {{ cssxref("direction") }} and {{ cssxref("unicode-bidi") }}, if a CSS page is active and the element supports these properties.
  • As the directionality of the text is semantically related to it and not to its presentation, it is recommended that web developers use this attribute instead of the related CSS properties when possible. That way, the text would be display correctly even on a browser which doesn't support CSS or with the CSS deactivated.

 

Normative document HTML5, section 8.5 ({{ HTMLVersionInline("4") }}: HTML4.01, section 17.11.2)
draggable {{ HTMLVersionInline("5") }}
Lorem ipsum
hidden {{ HTMLVersionInline("5") }}
Lorem ipsum
id
Lorem ipsum
itemid {{ HTMLVersionInline("5") }}
Lorem ipsum
itemprop {{ HTMLVersionInline("5") }}
Lorem ipsum
itemref {{ HTMLVersionInline("5") }}
Lorem ipsum
itemscope {{ HTMLVersionInline("5") }}
Lorem ipsum
itemtype {{ HTMLVersionInline("5") }}
Lorem ipsum
lang
Lorem ipsum
spellcheck {{ HTMLVersionInline("5") }}
Lorem ipsum
style
Lorem ipsum
tabindex
Lorem ipsum
title
Lorem ipsum

Revision Source

<p>WORK IN PROGRESS</p>
<p>HTML defines a few attributes that are common to all HTML elements.</p>
<dl> <dt><a name="attr-accesskey">accesskey</a></dt> <dd>This attribute hints for the generation of a keyboard shortcut for the current element. This attribute consists on a space-separated list of characters (one single Unicode code point). The browser should use the first one that exists on the computer keyboard layout.<br> {{ HTMLVersionInline("4") }} In previous versions of HTML, only one character could be specified. Also it wasn't a global attribute and could be applied only to the {{ HTMLElement("a") }}, {{ HTMLElement("area") }}, {{ HTMLElement("button") }}, {{ HTMLElement("input") }}, {{ HTMLElement("label") }}, {{ HTMLElement("legend") }} and {{ HTMLElement("textarea") }}.<br> <table class="fullwidth-table"> <tbody> <tr> <td>Normative document</td> <td><a class=" external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#the-accesskey-attribute" rel="external nofollow" target="_blank" title="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#the-accesskey-attribute">HTML5, section 8.5</a> ({{ HTMLVersionInline("4") }}: <a class=" external" href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey" title="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">HTML4.01, section 17.11.2</a>)</td> </tr> </tbody> </table> </dd> <dt><a name="attr-class">class</a></dt> <dd>Lorem ipsum</dd> <dt><a name="attr-contenteditable">contenteditable</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-contextmenu">contextmenu</a> {{ HTMLVersionInline("5") }} {{ unimplemented_inline() }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-dir">dir</a></dt> <dd>This enumerated attribute indicates the directionality of the element's text. It can have the following values: <ul> <li><span style="font-family: Courier New;">ltr</span>, which means <em>left to right </em>and is to be used for languages that are written from the left to the right (like English);</li> <li><span style="font-family: Courier New;">rtl</span>, which means <em>right to left</em> and is to be used for languages that are written from the right to the left (like Arabic).</li> </ul> <p> </p> <div class="note"> <p><strong>Usage notes: </strong></p> <ul> <li>This attribute can be overrided by the CSS properties {{ cssxref("direction") }} and {{ cssxref("unicode-bidi") }}, if a CSS page is active and the element supports these properties.</li> <li>As the directionality of the text is semantically related to it and not to its presentation, it is recommended that web developers use this attribute instead of the related CSS properties when possible. That way, the text would be display correctly even on a browser which doesn't support CSS or with the CSS deactivated.</li> </ul> </div> <p> </p> <table class="fullwidth-table"> <tbody> <tr> <td>Normative document</td> <td><a class=" external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#the-accesskey-attribute" rel="external nofollow" target="_blank" title="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#the-accesskey-attribute">HTML5, section 8.5</a> ({{ HTMLVersionInline("4") }}: <a class=" external" href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey" title="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">HTML4.01, section 17.11.2</a>)</td> </tr> </tbody> </table> </dd> <dt><a name="attr-draggable">draggable</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-hidden">hidden</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-id">id</a></dt> <dd>Lorem ipsum</dd> <dt><a name="attr-itemid">itemid</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-itemprop">itemprop</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-itemref">itemref</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-itemscope">itemscope</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-itemtype">itemtype</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-lang">lang</a></dt> <dd>Lorem ipsum</dd> <dt><a name="attr-spellcheck">spellcheck</a> {{ HTMLVersionInline("5") }}</dt> <dd>Lorem ipsum</dd> <dt><a name="attr-style">style</a></dt> <dd>Lorem ipsum</dd> <dt><a name="attr-tabindex">tabindex</a></dt> <dd>Lorem ipsum</dd> <dt><a name="attr-title">title</a></dt> <dd>Lorem ipsum</dd>
</dl>
Revert to this revision