How to show HTML/java codes in blogger(blogspot) blog posts

If you’re a blogspot platform blogger and want to show HTML source codes in your blog posts then you must had a hard time how to make it done. Check out Code BlogKori. You can see that I’ve created special boxes for those HTML codes and the code remains intact inside the post. It’s a nice trick for blogger platform if you’re willing to post tutorials and badges for your readers.

For this you have to take two simple steps,

Step 1

You have to add a special code inside your blogger template. Go to your blogger Dashboard > Layout > Edit HTML. Now hit CTRL+D on your keyboard and search this tag,

]]></b:skin>

Now you have to add this code above that code,

pre
{
background:#efefef;
border:1px solid #A6B0BF;
font-size:120%;
line-height:100%;
overflow:auto;
padding:10px;
color:#000000 }
pre:hover {
border:1px solid #efefef;
}
code {
font-size:120%;
text-align:left;
margin:0;padding:0;
color: #000000;}
.clear { clear:both;
overflow:hidden;
}

Now it will look something like this,

After you done it, click the “Preview” button to see if your blog shows or not. If everything’s okay, then click, “Save template

Step 2

Now each time you create a post and you need to add some HTML codes inside your post, you have to convert it into escapable characters. For this go to this tool called Quick escape and insert your code. Click, “Convert to escaped character” the converted code will be different than the original.

Now create a new blog post and add the converted code. You have to enclosed the code with a “pre” tag(marked as blue) For this I’ve added the same code twice. One normally and the other one with the hack.

Publish your post and see the magic! The normal code showed up with the effect but the hacked on remained intact inside the table.

Please leave a comment with your response and any suggestion for this blogger hack. If you run into any trouble, feel free to ask me a question. Please do share/save this page if it helped you.

Promotional Workwear

Related posts on this topic

{ 8 comments… read them below or add one }

1 scrollock April 5, 2009 at 3:29 pm

you best haa i try to my blog and look good thanks so much

scrollock’s latest blog post..Ongbak 2 aka fist tyrant 2 DVDrip Movie 2008

Reply

2 Sylvain May 22, 2009 at 5:13 pm

Thanks this was useful.

Reply

3 sansayan June 29, 2009 at 4:18 pm

It works, thanks for your valuable info.

Reply

4 Tamal Anwar July 2, 2009 at 9:03 pm

@scrollock
@Sylvain
@sansayan

~thanks for letting me know that. Blogspot has changed their HTML couple of times and glad that this tip still works!

Reply

5 Kris July 31, 2009 at 11:26 am

Thank you! It works like a charm.

Reply

6 Basant Singh December 5, 2009 at 6:02 pm

Quick escape is good. Thanks for sharing.

Reply

7 l_i_z December 24, 2009 at 2:00 am

I mentioned your blog here. :)

Reply

8 kamrul March 2, 2010 at 12:52 pm

dear Tomal, please let us know how do yo give a different background colour for HTML code. in this post you have darker background for bellow code
pre
{
background:#efefef;
border:1px solid #A6B0BF;
font-size:120%;
line-height:100%;
overflow:auto;
padding:10px;
color:#000000 }
pre:hover {
border:1px solid #efefef;
}
code {
font-size:120%;
text-align:left;
margin:0;padding:0;
color: #000000;}
.clear { clear:both;
overflow:hidden;
}

please let us know. thanks for help.
kamrul´s last blog ..Photo Post: My early days of blogging and how BlogKori started My ComLuv Profile

Reply

Leave a Comment

CommentLuv Enabled

Comments links could be nofollow free.

Previous post:

Next post: