DNS Google

Un Official dns google Blog

Reducing the file size of HTML documents

Authors: Jens Meiert & Kevin Khaw, Google Webmasters

Recommended experience: Basic HTML

A clear way to improve the load time of your site is to decrease the file size of your HTML documents. There are several ways to do this, from rigid compression to acupuncture-like ID and class name changes. Here we’ll have a quick look at an HTML feature you can use to make your markup significantly leaner.

HTML – as opposed to XHTML, even when delivered with the MIME type text/html – allows authors to omit certain tags. According to the HTML 4 DTD, you can omit the following tags (tags of so-called “void” – empty – elements are marked as strikethrough):
  • </area>
  • </base>
  • <body>
  • </body>
  • </br>
  • </col>
  • </colgroup>
  • </dd>
  • </dt>
  • <head>
  • </head>
  • </hr>
  • <html>
  • </html>
  • </img>
  • </input>
  • </li>
  • </link>
  • </meta>
  • </option>
  • </p>
  • </param>
  • <tbody>
  • </tbody>
  • </td>
  • </tfoot>
  • </th>
  • </thead>
  • </tr>
For example, if you have a list of items marked up as <li>List item</li>, you could instead just write <li>List item. Or instead of a paragraph that you’d usually close with </p>, you could just use <p>My paragraph. This even works with html, head, and body, which are not required in HTML. (Make sure you feel comfortable with this before making it your standard coding practice.)
Omitting optional tags keeps your HTML formally valid, while decreasing your file size and making your code look much leaner. In a typical document, this can mean 5-20 % savings. Applying this and a few other techniques in our Privacy Centers, we managed to save about 20 % of the original file size.
You've just read an article with category HTML With Title Reducing the file size of HTML documents. You can bookmark this page with a URL http://dnsgoogle.blogspot.com/2012/09/Reducing-the-file-size-of-HTML-documents.html. Thanks For Your Attention!
ReWrite and Review By : Dewi Dewiq - Tuesday, September 11, 2012