Are Blank Lines in the HTML Source Code a Problem?

by 7 replies
9
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
#website design #blank #code #html #lines #problem #source
  • 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).
    • [1] reply
    • Or use Tinymce Advanced, it has the option to turn of the line breaks and stuff

      Regards
      Dave
  • 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.
  • 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.
  • 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
  • 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.
  • 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.

Next Topics on Trending Feed