Display Code in Blogger Posts

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 &#38lt;

2. Replace > (i.e. greater than sign) with &#38gt; 3. Replace (i.e. quote mark) with &#38quot;


Example:

We want to display the code below on our webpage – <a href=http://example.blogspot.com/>Example Post</a>

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

&#38lt;a href=http://example.blogspot.com/&#38gt;Example Post&#38lt;/a&#38gt;

No comments:

Post a Comment

Commonly Used Abbreviations Used Daily

Although, we tend to use short form of long words in daily life but there are many abbreviations which we don't remember. Below is the l...