HTML space overhead

I began to wonder what the general impact of using spaces on indented html documents is.

Why not just use tabs for indentation? Wouldn't that be more economical: 1 char (\ t) compared to example 4 characters (spaces)?

I have experimented little with converting an asp.net page to use tabs and comparable rendering markup sizes. Replacing only one partial empty space, the page size of 22kb decreased to 19.4kb →, which is 12% less. Having changed all the indents, the page ended the selection of 16.7kb - a reduction of 24%! (chrome dev and Fiddler tools are used to check)

Is my judicious sound? Should tabs be used primary for HTML attachments? Is there any reason to use spaces (e.g. compatibility with exotic browsers)?

ps. Stackoverflow also uses spaces. Converting the SO homepage to use tabs gave a 9% reduction. Is this a reliable observation? If so, why didn't they use tabs?

+5
source share
3 answers

StackOverflow uses HTTP compression - when it is enabled, the differences between spaces and tabs are reduced - a lot.

You need to run tests in compressed versions for reliable results.

, , , .

+5

: html . . , , .

// HTML: HTML- , .

StackOverflow HTTP

HTML , CSS JS: , . , HTML JS- ( ) CSS ( ), .

. , HTML. . . - .

.. , HTML, HTML (, , JSMin cssmin.js JavaScript CSS) .

: http://code.google.com/speed/page-speed/docs/payload.html#MinifyHTML

+2

? : 1 char (\ t) 4 ()?

If you are concerned about the loaded HTML size, you won’t bother with the vs-space tabs - you compress your HTML code as it appears wire and minimize your markup, CSS and Javascript , which provide real savings and do not interfere with your own encoding rules.

+1
source

All Articles