开发者

Does the order of HTML attributes have any effect on performance?

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 attribute开发者_StackOverflow中文版s 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.


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.


It all depends on the layout engine, but i suspect it would be negligible. You should not be concerned with this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜