B. HTML5 Global Attributes

B

HTML5 Global Attributes

The following attributes may be used with any HTML element.

Attribute

Values

Description

accesskey
single text character

Assigns an access key (shortcut key command) to the link. Access keys are also used for form fields. Users may access the element by pressing Alt-<key> (PC) or Ctrl-<key> (Mac). Example: accesskey="B"

class
text string

Assigns one or more classification names to the element. Multiple values are separated by spaces.

contenteditable

true | false

Indicates the user can edit the element. If the value is an empty string, it is the same as “true.” By default, the element inherits the edit setting from its parent.

dir

ltr | rtl | auto

Specifies the inline text direction of the element (“left to right” or “right to left”) and scopes bidirectional reordering, isolating the text from influencing surrounding content. When set to auto, it uses the first letter to determine direction.

draggable

true | false

A true value indicates the element is draggable in the UI (an event configured with JavaScript), meaning the user can move it by clicking and holding it, and then moving it to a new position in the window.

hidden

In HTML, list value only: hidden

In XHTML, include attribute name: hidden="hidden"

Prevents the element and its descendants from being rendered in the user agent (browser). Any scripts or form controls in hidden sections will still execute ...

Get Learning Web Design, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.