O'Reilly logo

HTML5 Pocket Reference, 5th Edition by Jennifer Niederst Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

HTML5 Global Attributes

A number of attributes are shared by all elements in HTML5 and are referred to collectively as the Global Attributes:

accesskey="character"

Assigns an access key (shortcut key command) that activates or focuses the element. The value is a single character. Users may access the element by hitting Alt-<key> (PC) or Ctrl-<key> (Mac).

class="text string"

Assigns one or more classification names to the element.

contenteditable="true|false"

Not in HTML 4.01. Indicates the user can edit the element. This attribute is already well supported in current browser versions.

contextmenu="id of menu element"

Not in HTML 4.01. Specifies a context menu that applies to the element. The context menu must be requested by the user, for example, by a right-click.

dir="ltr|rtl|auto"

Specifies the direction of the element. ltr indicates left to right; rtl indicates right to left; and auto indicates that direction should be determined programmatically.

draggable="true|false"

Not in HTML 4.01. Indicates the element is draggable, meaning it can be moved by clicking and holding on it, and then moving it to a new position in the window.

dropzone="copy|move|link|string:text string type|file:file type"

Not in HTML 4.01. Indicates what happens when a data is dragged onto the element and what kind of data to accept. copy results in a copy of the dragged data; move moves the data to a new location; and link results in a link to the original data. Including string:text/plain allows it to accept any text ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required