views:

132

answers:

2

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?

+2  A: 

A list of attributes is available here: http://en.w3schools.com/tags/tag_div.asp

  • class
  • dir
  • id
  • lang
  • style
  • title
  • xml:lang

Plus all the event attributes:

  • onclick
  • ondblclick
  • onmousedown
  • onmousemove
  • onmouseout
  • onmouseover
  • onmouseup
  • onkeydown
  • onkeypress
  • onkeyup
Guillaume Flandre
+5  A: 

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.

Sinan Ünür
+1 for the actual spec, not w3schools's unofficial and often inaccurate materials.
bobince