HyperText Markup Language/Standard Attributes List
From Wikibooks, the open-content textbooks collection
Below is a list of all attributes which are available for most elements in HTML.
You can also view a list of HTML elements.
Contents |
[edit] Attributes
[edit] class
This attribute allows you to designate an element to be a member of a given class. Multiple elements can be assigned to the same class (eg. <p class="myclass"> ... </p> <p class="myclass"> ... </p>), as well as a single element belonging to multiple classes (eg. <p class="class-one class-two"> ... </p>).
[edit] code
[edit] codebase
[edit] dir
With this attribute you can define which direction the text is written for a given element, either ltr for left-to-right or rtl for right-to-left.
[edit] height
[edit] id
This attribute allows you to define a unique identifier for each element. This would be useful for hyperlinks that link to a specific section of a page or when styling using a style sheet.
[edit] lang
With this attribute you can specify a language that is used for an element.
[edit] style
[edit] title
With this attribute you can define what will be displayed when a user hovers the element. It is not available for base, head, html, meta, param, script, style, and title.
[edit] width
[edit] More attributes
[edit] accesskey
The accesskey attribute defines a keyboard shortcut for a hyperlink or form element. The combination of keys need to activate the shortcut varies from browser to browser. In Microsoft Internet Explorer the user must press Alt+accesskey. If the shortcut is for a link the user must then press Enter to follow the link. The choice of Alt+accesskey means that access keys can clash with shortcuts built-in to the browser.
It is quite common to use numbers for the access keys since these don't clash with any major browser's built-in shortcuts, e. g.
- 1 = Home Page
- 0 = List of access keys on this website.
<div id="navigation">
<h2>Navigation</h2>
<ul>
<li><a accesskey="1" href="/">Home page</a></li>
<li><a accesskey="2" href="/about">About</a></li>
<li><a accesskey="0" href="/accesskeys">Access keys</a></li>
</ul>
</div>
There is no standard way to let users know the access keys that are available on the page. Some suggestions can be found in Accesskeys: Unlocking Hidden Navigation.