Feb 11, 2014

f Comment

Google Blogger Changes My HTML Post Upon Saved. Why? How Do You Fix It?

When you save your HTML post in Google Blogger sometimes Blogger modifies the HTML a little, but it should not affect how your blog post looks when rendered in a web browser. However one day I realized that Blogger changed the content of my HTML post and removed all the breaks and newlines I had inserted in the post.

Why does Blogger alter my HTML post's body and remove breaks? My blog post looks like it's all bunched together. Read on to see the cause of this problem and how to fix it.

I have 'Press "Enter" for line breaks' radio button selected under 'Line breaks' in Options.

Root Cause

I realized that my post has the following line of code:

<div class='cb'/>

It turns out that if my HTML contains self-closing tags or is not well-formed, meaning there is unclosed HTML tag or incorrectly nested HTML tags, then Blogger may do this.

Solution

So the solution is simple. Simply make sure there are no self-closing tags and that your HTML body is well-formed. Every HTML tag must have a matching closing tag. The entire HTML content must be correctly nested.

I changed the following line:

<div class='cb'/>

to the following line:

<div class='cb'></div>

And the problem is gone.

Questions? Let me know!
Please leave a comment here!
One Minute Information - by Michael Wen
ADVERTISING WITH US - Direct your advertising requests to Michael