很少有HTML屬性是標準的,並且與所有HTML標記關聯。這裡列出了這些屬性並進行了簡要描述。
Global Attributes
在base、head、html、meta、param、script、style和title元素中無效。
Attribute | HTML-5 | Description |
---|---|---|
accesskey | Specifies a shortcut key for an element to be used in place of keyboard. | |
class | The class of the element | |
contenteditable | Yes | Boolean attribute to specify whether the element is editable or not. |
contextmenu | Yes | Specifies a context menu for an element. |
data-* | Yes | Used to store custom data associated with the element. |
draggable | Yes | Boolean attribute to specify whether the element can be dragged or not. |
dropzone | Yes | Specifies whether the dragged data is copied, moved, or linked, when dropped. |
hidden | Yes | Specifies whether element should be visible or not. |
id | A unique id for the element | |
spellcheck | Yes | Specifies if the element must have it's spelling or grammar checked. |
style | An inline style definition | |
tabindex | Specifies the tab order of an element. | |
title | A text to display in a tool tip | |
translate | Yes | Boolean attribute specifies whether the content of an element should be translated or not |
Language Attributes
lang屬性表示用於封閉內容的語言。使用ISO標準語言縮寫來標識語言,例如fr表示French,en表示English,等等。
rfc1766(http://www.ietf.org/RFC/rfc1766.txt)描述了這些代碼及其格式。
在base、br、frame、frameset、hr、iframe、param和script元素中無效。