Google Code Prettify

If u want code samples to be syntax-highlighted on your blog. Pure CSS would not work, unless the code samples were completely messed up with spans and divs to indicate which style to apply to every word, number or punctuation.

If u want something like this, where some part of the code needs to be highlighted ....

You can opt for google code prettify

The coding is very simple
<link href="" type="text/css" rel="stylesheet" />
<script type="text/javascript" src=""></script>
<body onload="prettyPrint()">
<pre class="prettyprint">void
main(char* argv[])
printf("Hello, Bob.\n");
<pre class="prettyprint">public class Main {
public static void main(final String[] args) {
System.out.println("Hello, Bob.");
<pre class="prettyprint">echo "Hello, Bob."</pre>

Source :