Wednesday, July 4, 2007

How to display html code in blog post

Wednesday, July 4, 2007
Suppose you are writing a article which includes HTML code and that code you want to share with rest of the world. But displaying HTML Code on a webpage is not easy because the browser tends to interpret the HTML tags instead of displaying them. It will be simple to understand the reason behind it if we know how does the browser know something is an HTML tag? Browser looks for opening and closing brackets that starts and ends a tag. So those brackets (i.e. < & >) are the key. Now it is obvious that if we change those starting and ending brackets sign with something else, our problem will be solved.

Solution:

1. Replace < (i.e. less than sign) with &lt;

2. Replace > (i.e. greater than sign) with &gt;

3. Replace “ (i.e. quote mark) with &quot;

Example:

We want to display the code below on our webpage –

<a href=http://topaix.blogspot.com/>Digital Knowledge Center</a>

We would replace <> sign with &lt; and &gt; respectively. The result will look like this –

<a href=http://topaix.blogspot.com/>Digital Knowledge Center</a>

1 comments:

Anonymous said...

phentermine 37.5 can buy phentermine online - buy phentermine online no prescription needed