Size optimization of a HTML document

Paul Smith phhs80 at gmail.com
Tue Nov 29 16:30:32 UTC 2005


On 11/29/05, Matt Morgan <minxmertzmomo at gmail.com> 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
> >
> > Thanks, Andy. To edit HTML documents, I use nvu. However, after having
> > removed some links, the document stays with the same size. I
> > understand your strategy, but is there some automatic way of doing
> > that? I mean a program to automatically optimize the size of a HTML
> > document.
>
> HTML Tidy?

Thanks to all. HTML Tidy seems to be the right tool. However, the HTML
code of my document is not valid (602 errors are found). Is there some
automatic way of getting all those errors repaired?

Paul




More information about the users mailing list