Monday, November 28, 2016

How to Add code snippets in posts Blogger/Wordpress

Adding code snippets to a blog post

If you have a blog where you often Add code snippets in posts this trick will entertain you you can add code snippets in posts using this simple css script which we align all of your code in lines and your codes will look great in posts see here i Use this script in post where i add a code snippet of C# program to Convert lower case letter to upper case.
Here is css script which might be useful to all readers, This is not for syntax highlighting but works well for presenting the source code in original format.

 <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>

How to use :

Paste this snippet in text editor.
Paste your code in <<<<<<>>>>>> block.
Copy all and paste to HTML view in blogger(or any other) post editor.