Mobile app version of vmapp.org
Login or Join
Annie201

: HTML coding style: attribute starts on a new line sublvl's front end developer seems to have a strange coding style that I've never seen before. Every time they begin a new element, immediately

@Annie201

Posted in: #Html #Html5

sublvl's front end developer seems to have a strange coding style that I've never seen before. Every time they begin a new element, immediately after the element name they insert a line break. The first thing that appears on the next line is the first attribute of the element. For example:

id="player-container"><div
id="player-bar"><div
id="player-controls-wrapper"><div
id="player-controls"><div
id ="player-controls-buttons"> <a


The above code was found here.

I've never seen this kind of coding style before. What's going on here? Is this just a quirky style or is there some reasoning behind it?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Annie201

1 Comments

Sorted by latest first Latest Oldest Best

 

@Harper822

It appears to be minification by the W3 Total Cache WordPress plugin. This strategy of inserting a line break at the end of the element name seems to be to prevent the line length from becoming too excessive, while taking advantage of the fact that a line break is valid white space for separating tokens in HTML.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme