📜  HTML-属性参考

📅  最后修改于: 2020-12-16 05:59:18             🧑  作者: Mango


很少有HTML属性是标准的并与所有HTML标签相关联。这些属性在此处列出,并带有简要说明。

全局属性

在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

语言属性

lang属性指示用于随附内容的语言。使用ISO标准语言缩写来标识语言,例如fr代表法语en代表英语,等等。

RFC 1766(http://www.ietf.org/rfc/rfc1766.txt)描述了这些代码及其格式。

在base,br,frame,frameset,hr,iframe,param和script元素中无效。

Attribute Value Description
dir ltr | rtl Sets the text direction
lang language_code Sets the language code