HTML/標準屬性列表

HTML的大多數元素(element)可用的屬性(attribute)清單:

Attributes

編輯

該屬性指出一個元素屬於給定的類。多個元素可以屬於同一個類(如 <p class="foo"> ... </p> <p class="foo"> ... </p>)。 同樣,單個元素可以屬於多個類(如 <p class="foo bar"> ... </p>)。

codebase

編輯

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.

height

編輯

設置元素的像素高度,如<div height="150"> ... </div>

給元素指定獨一無二標識符。

指定元素的語言

指定元素的特定style

當用戶hover在元素上,顯示這個title文字。下述元素不可用本屬性:base, head, html, meta, param, script, style, title.

設置元素的像素高度,如 <div width="230"> ... </div>

更多attributes

編輯

accesskey

編輯

accesskey屬性定義了超鏈接或form元素的鍵盤快捷鍵。 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.

tabindex

編輯