Reputation: 638
Is there any reason that relates to parsing time, layout, rendering time, style application, etc. to have HTML attributes in a certain (or consistent) order?
The order of HTML attributes does not improve a page's compressibility significantly, and maintaining some order can make the markup easier for human readers to figure out (e.g. putting id
first, starting <input>
s with type
, putting boolean attributes at the end of an opening tag) but I'd like to know if there are any performance reasons to consider attribute order.
Upvotes: 8
Views: 2710
Reputation: 5259
None to speak of I don't think. All the properties within each tag have to be parsed and read before the tag can be properly understood by the browser.
As long as the code is syntax-error free and (obviously) the shorter the better.
Upvotes: 3
Reputation: 191058
It all depends on the layout engine, but i suspect it would be negligible. You should not be concerned with this.
Upvotes: 2