HTML attributes Order

Attribute order

HTML attributes should come in this particular order for easier reading of code.
  • class
  • idname
  • data-*
  • srcfortypehrefvalue
  • titlealt
  • rolearia-*
Classes make for great reusable components, so they come first. Ids are more specific and should be used sparingly (e.g., for in-page bookmarks), so they come second.


FROM http://codeguide.co/#html-attribute-order

留言

這個網誌中的熱門文章

[java]BIG5 字集判斷

[java]半型轉全型

[javascript]當月第一天、當月最後一天