Are Blank Lines in the HTML Source Code a Problem?

by Isaan
7 replies
  • WEB DESIGN
  • |
Hi,

I just discovered that I have many blank lines in the HTML source code of all my sites.

I use two themes, WhooThemes (Canvas) and Socrates, and on both themes this happen.

For example, before I got   in the HTML source code if I used enter for a line break in the visual mode. Now there's no   anymore, but also a blank line in the HTML source code.

I have a few questions about this:

1) Is this really a big problem?

2) Why does this happen?

3) How can I solve this?

Your help is very welcome!

Isaan
#blank #code #html #lines #problem #source
  • Profile picture of the author David V
    It's not the themes, and it's not a problem.

    The visual editor in WP is doing it every time you hit return.

    Also, if you switching back and forth between visual/text mode, the html markup may not be preserved (div tags changing to p tags).

    There are many plugins at wordpress.org to stop this (search preserved markup or similar).
    {{ DiscussionBoard.errors[7600735].message }}
    • Profile picture of the author david carr
      Originally Posted by David V View Post

      There are many plugins at wordpress.org to stop this (search preserved markup or similar).
      Or use Tinymce Advanced, it has the option to turn of the line breaks and stuff

      Regards
      Dave
      Signature

      {{ DiscussionBoard.errors[7601246].message }}
  • Profile picture of the author shipwrecked
    Shouldn't be a major issue if there are just a few blank spaces...

    It's important to reduce blank space in the CSS file as much as possible. I'd concentrate more on that one.
    {{ DiscussionBoard.errors[7605892].message }}
  • Profile picture of the author DJL
    The NotePad++ text editor has a handy tool for deleting blank lines.
    You can use it for php, html, css, or most any kind of text file.
    Note: always save a backup copy before fiddling with any online files.
    Signature

    None are more hopelessly enslaved than those who falsely believe they are free.
    --Johann Wolfgang von Goethe, Elective Affinities (1809)

    {{ DiscussionBoard.errors[7606173].message }}
  • Isaan,

    Blank space in your CSS, HTML, JS and other files is not a problem per se but it can be a hindrance on load speed which in turn is a problem for SEO.

    Here is a good writeup on minifying those files,

    Tools for concatenating and minifying CSS and JavaScript files in different development environments - Robert's talk

    Best,

    Shawn
    Signature
    Outsource to the experts...

    We customize your Blog, eBook, Press Release and Sale Copy content with your message.

    {{ DiscussionBoard.errors[7606717].message }}
  • Profile picture of the author UMS
    Each blank line takes up 1 byte of information. Given that the typical webpage is generally thousands of bytes, then it really isn't an issue.
    {{ DiscussionBoard.errors[7609049].message }}
  • Profile picture of the author crescendo
    Blank Lines in an HTML source code are not problematic and you do not need to worry about them as they shall play no role in your website unless you insert breaks and spaces. Blank spaces in a CSS file are a matter of concern as the more spaces and blank lines means the larger the file and the longer it would take for a stylesheet to load.
    {{ DiscussionBoard.errors[7880838].message }}

Trending Topics