HTML Attribute Order

HTML attributes should come in this order for easier reading of code.

  • class
  • id, name
  • data-*
  • src, for, type, href, value
  • title, alt
  • ng-*
  • role, target, aria-*, style
<div class="#" id="#" ng-show="#" style="#"></div>

<a class="#" data-toggle="modal" href="#" target="#">Link Text</a>

<input class="form-control" type="text">

<img class="#" src="#" alt="#">