none
Whitespace in HTML RRS feed

  • Question

  • My housekeeping has never been the greatest and in some of my html and aspx files I inadvertently leave large areas of whitespace after many cut and paste jobs :-) ) Does this affect the way files are presented on browsers?

    Mart

    Wednesday, May 26, 2010 9:55 AM

Answers

  • The impact is neglibible. In html no matter how much whitespace you have unless you have wrapped it in a <pre> element only one space will appear in the browser.

    As Ian said it will bloat your file size up slightly but rarely does it make much real world difference.


    MS MVP Expression Tutorials & Help http://by-expression.com
    • Marked as answer by Stabes Wednesday, May 26, 2010 1:46 PM
    Wednesday, May 26, 2010 1:32 PM

All replies

  • It makes a difference to page size but is unlikely to have much impact on load times unless there's a huge amount of whitespace. Try cleaning a page up and see what difference it makes. I suppose if it was repeated over hundreds of pages in a busy site you might see an impact on bandwidth usage.

    There are a few instances I've come across where having whitespace in between table cell tags gives issues, but it's obvious when it occurs.

    Ian
    MS MVP Expression

    http://www.ew-resource.co.uk
    http://www.fp-resource.co.uk


    Ian Haynes
    Wednesday, May 26, 2010 10:23 AM
  • My housekeeping has never been the greatest and in some of my html and aspx files I inadvertently leave large areas of whitespace after many cut and paste jobs :-) ) Does this affect the way files are presented on browsers?

    Mart


    Switch to code view, right click and select Reformat HTML.
    Expression Web MVP
    Wednesday, May 26, 2010 12:20 PM
  • Steve,

    I know about the reformatting. Was just interested to know the impact if I didn't reformat.

    Mart

    Wednesday, May 26, 2010 12:30 PM
  • The impact is neglibible. In html no matter how much whitespace you have unless you have wrapped it in a <pre> element only one space will appear in the browser.

    As Ian said it will bloat your file size up slightly but rarely does it make much real world difference.


    MS MVP Expression Tutorials & Help http://by-expression.com
    • Marked as answer by Stabes Wednesday, May 26, 2010 1:46 PM
    Wednesday, May 26, 2010 1:32 PM
  • Thanks Cheryl. That's what I wanted to hear - it makes no real difference :-)

    Mart

    Wednesday, May 26, 2010 1:46 PM
  • One small photo is worth 50,000 white spaces.
    Wednesday, May 26, 2010 2:29 PM