Thursday, January 8, 2015

Making gray background for code block in Blogger posts

You might want to have gray background for your code block to make it more readable as below.
> echo "Hello World!"

1. Go to your Blogger dashboard and click on Template then Edit HTML.
2. Add the following code above the </head> tag and save.
<style>
pre.codeblock {
   background:#E8E8E8;
}
</style>
3. Create a new post and add the following code.
<pre class="codeblock">
> echo "Hello World!"
</pre>


No comments:

Post a Comment