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

编辑