Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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.

like image 551
lucasrizoli Avatar asked May 25 '11 14:05

lucasrizoli


People also ask

Does order matter with HTML attributes?

The order of attributes in HTML elements doesn't matter at all. You can write the attributes in any order you like. but what sequence should be prefer, in practical?

Where should HTML attributes be placed?

Attributes go inside the opening HTML tag. The attribute name is a predefined name from the HTML specification. There are many: href , title , class , src , etc. The attribute value is that data for the attribute.

What are the 4 attributes of HTML?

There are some attributes, such as id , title , class , style , etc. that you can use on the majority of HTML elements.

What are the 3 types of attribute in HTML?

HTML attributes are generally classified as required attributes, optional attributes, standard attributes, and event attributes: Usually the required and optional attributes modify specific HTML elements. While the standard attributes can be applied to most HTML elements.


1 Answers

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.

like image 187
cusimar9 Avatar answered Sep 28 '22 19:09

cusimar9