How to add a nice code block to blogger

How to add a nice code block to blogger

While there are awesome syntax highlighting and styling libraries  with nicely written tutorials for using them with blogger, a simple ‘code’ tag can suffice at times…

For such times:

.myCodeHighlighter {
border-left: 4px solid #FF9933;
display: block;
font-family: Courier,"Courier New",monospace;
margin: 15px;
overflow: auto;
padding: 15px;
text-align: left;
white-space: nowrap;
}

And use as:

<code class="myCodeHighlighter">
//the code codes here..
</code>

A preview of how it will make your code tags look like? You are looking right at it! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.