Code Block for Blogger / Blogspot

Nov 12, 2009
Added following to template (Layout->Edit html) in body section: code { font-family: Courier; margin:.75em 0; border:1px dashed #CCC; padding:5px 15px; display: block; background-color: #F4F5F7; overflow: auto; white-space: pre; } Above box itself is result of <code>...</code> tag.

An example:code block retains the whitespace & any other formatting in plain text.
Another Example:T h i s is a realllllllllllllllllyyyyyyyy looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnngggggggggggggggg cooooooooooooooooooooode block
This is output of<blockquote> ... </blockquote>
blockquotes does NOT retains the whitespace OR any other formatting in plain text.

Note: Any HTML code between <code></code> is also treated as HTML. Use this HTML encoder to encode to HTML code before posting. Or, paste the HTML code in Compose tab (not in "Edit HTML" tab) of the post editor (Make sure that you have selected "Show HTML literally" in Compose Settings under Post Options).