Size optimization of a HTML document

Andy Pieters mailings at vlaamse-kern.com
Tue Nov 29 13:25:21 UTC 2005


On Tuesday 29 November 2005 13:53, Paul Smith wrote:
> Is there some way of optimize the size of a HTML document?

There are MANY ways to optimize the size of a html document.

One thing to note is that if you manually make the html document, that it 
might quickly become a burden.

If you are following current standards, you already seperated content from 
layout so all your stylesheets and javascripts are already external 
references.

That said, it is perfectly legal to strip *all* line breaks from the document 
(I DO mean linebreaks and not <br>'s)

Also, since html collapses whitespaces you can remove all sequences where 
there is more then one whitespace.

Example (the _ denotes whitespace)

<p>This_is_a__________sentence</p>

In this example all the whitespace between a and sentence can be converted to 
a single one, since it will be treated that way by the html parser.

Keep in mind that if you later have to edit the document manually, things will 
be more difficult for you because the linebreaks are to make the source more 
human readable.

With kind regards

Andy

-- 
Now listening to JDS - Higher Love on amaroK
Geek code: www.vlaamse-kern.com/geek
Registered Linux User No 379093
If life was for sale, what would be its price?
www.vlaamse-kern.com/sas/ for free php utilities
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20051129/6ff0bd95/attachment-0002.bin 


More information about the users mailing list