How to add code snippets in blogger posts?

Hi,

If you are using blogger and unable to find an option in your blog post editor to add code snippets, then you have come to the right place.



While writing/editing your blog into the blogger editor, you can see two tabs in the menu bar, which say Compose and HTML.

Select the HTML tab and where you need to write your code, paste this: 

 <pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; 
                color: #000000; background-color: #eee;
                font-size: 12px; border: 1px dashed #999999;
                line-height: 14px; padding: 5px; 
                overflow: auto; width: 100%">
       <code style="color:#000000;word-wrap:normal;">

            <<<<<<<YOUR CODE HERE>>>>>>>

       </code>
 </pre>

And paste your code snippet at  <<<<<<<YOUR CODE HERE>>>>>>>, while staying in the HTML tab.

Now, select the Compose tab and see the result. If the result troubles you, remove your code snippet from the HTML tab and try pasting your code snippet being in the Compose tab.

You can now proceed with writing your article and publishing it.

Thanks for reading!

Comments