什么是HTML中的DIV元素的有效属性?

前端之家收集整理的这篇文章主要介绍了什么是HTML中的DIV元素的有效属性?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
什么是所有有效的DIV属性

基于this link,它只显示类,id,标题.那是对的吗?含义,for属性和其他对DIV无效?

解决方法

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 for label,并指定标签应用于的输入元素的id属性.

另见HTML5 specs

The div element has no special meaning at all. It represents its children. It can be used with the class,lang,and title 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 the div element leads to better accessibility for readers and easier maintainability for authors.

猜你在找的HTML相关文章