HTML and CSS Reference
In-Depth Information
An xml:lang attribute can also specify the content's language. This is the XML format
for the lang attribute, as it should occur in XML documents. XHTML documents are both
XML and HTML (depending on how the server delivers them), so both the lang and
xml:lang attributes may be applied to an element in XHTML, both with the same value.
The xml:lang attribute isn't needed (or valid) in an HTML5 document.
Focus Attributes
When some elements—especially links and form controls—are in a pre-active state, they are said to have
focus because the browser's “attention” is concentrated on that element, ready to activate it. You can
apply these focus attributes to some elements to enhance accessibility for people using a keyboard to
navigate your web pages by cycling the browser's focus through the document:
accesskey : Assigns a keyboard shortcut to an element for easier and quicker access through
keyboard navigation. The value of this attribute is the character corresponding to the access key.
The exact keystroke combination needed to activate an access key varies between browsers and
operating systems.
tabindex : Specifies the element's position in the tabbing order when the Tab key is used to cycle
through links and form controls.
Interactive Attributes
HTML5 introduces a number of new attributes to indicate that elements can be manipulated by users and
applications. You won't find these attributes in HTML 4.01 or XHTML 1.0, and even in HTML5 they're not
all supported by every current browser. Some of these relate to those scripting APIs we mentioned in the
last chapter, and they're very cool, but well beyond the scope of this topic. We're briefly listing these
attributes here so you'll recognize them when you come across them in the wild, but they're fairly
advanced and you won't see them again in these pages. We're sorry to get your hopes up only to dash
contenteditable : Indicates that users can edit the element's content. This attribute only
accepts the values true , false , or inherit , and it can also be minimized. The minimized form
with no value is equivalent to contenteditable="true" .
contextmenu : Associates the element with a contextual menu elsewhere in the document. This
attribute's value is the ID of a menu element within the same document ( menu will be introduced in
Chapter 8).
draggable : Indicates that the element can be dragged by the user to another area of the
rendered page (this is used by the Drag and Drop API). This attribute only accepts the values
true , false , or auto , and is minimizable. The minimized form with no value is equivalent to
draggable="auto" .
Search WWH ::

Custom Search