HTML中DIV元素的有效属性是什么? [英] What are valid attributes for the DIV element in HTML?
问题描述
什么是有效的 DIV
属性?
基于这个链接,它只显示 class
, id
, title
。那是对的吗?意思是属性的对于
DIV
?
请参阅 W3C规范:
id
,class
(文档范围的标识符)
lang
信息),dir
(文字方向)
title
style (内联样式信息) code>(alignment)
onclick
,ondblclick
,onmousedown
,onmouseup
,onmouseover
,onmousemove
,onmouseout
,onkeypress
,onkeydown
onkeyup
另见 HTML5 specs : for
用于 label
,并指定输入元素,标签适用。
$ b
div
元素根本没有特别的意义。它代表了它的孩子。它可以用于类
,lang
和title
属性来标记一组连续元素的通用语义。
注意:强烈建议作者查看
div
元素作为最后一招的元素,因为当没有其他元素适合时。使用更合适的元素而不是div
元素可以提高读者的可访问性,并且更易于作者维护。
What are all the valid DIV
attributes?
Based on this link, it appears only class
, id
, title
. Is that correct? Meaning, the for
attribute and others is not valid for DIV
?
See W3C specs:
id
,class
(document-wide identifiers)lang
(language information),dir
(text direction)title
(element title)style
(inline style information)align
(alignment)onclick
,ondblclick
,onmousedown
,onmouseup
,onmouseover
,onmousemove
,onmouseout
,onkeypress
,onkeydown
,onkeyup
for
is for label
and specifies the id
attribute of the input element to which the label applies.
See also the HTML5 specs:
The
div
element has no special meaning at all. It represents its children. It can be used with theclass
,lang
, andtitle
attributes to mark up semantics common to a group of consecutive elements.Note: Authors are strongly encouraged to view the
div
element as an element of last resort, for when no other element is suitable. Use of more appropriate elements instead of thediv
element leads to better accessibility for readers and easier maintainability for authors.
这篇关于HTML中DIV元素的有效属性是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!