Tuesday, August 23, 2011

Display programming code in a blogger post

As I was composing my first blog post (which is now the second one), I realized I needed to learn how to put programming code into a Blogger post.

After trying a bunch, I found this link had the solution I liked the best : http://www.bloggergeeze.com/2010/02/how-to-create-code-block-on-blogger.html.

The HTML encoder worked well for PHP, HTML, CSS and Javascript.

I modified their css a bit to better suit my tastes.
.post code {
  width: 550px;
  font-family: Courier;
  margin: 0;
  border: 1px solid #596;
  border-width: 1px 1px;
  padding: 5px;
  display: block;
}

And there you have it!

No comments:

Post a Comment