How To Write Tags

If you want to write posts on how to-s and tips about website / blogging, sometimes you need to show HTML tags in your posts. Simple methods of copy and paste will not work here, because browsers will interpret the tags (along with its mark ups of < and >) as real tags and therefore, will not show them (in monitors). If you want your readers to be able to see the tags in their browsers, you need more efforts than copy-paste.

For example, if we want to show an example of using a tag in our imaginary post titled “How to use span tags”:
<span style=”color: red”> The span tag will make this text red </span>
And we copy all the characters, and paste them in our posts, people will not see the same characters, but instead:
The span tag will make this text red
That is not too clear to explain the method to our readers, isn’t it? Browsers will consider the ‘example’ span tag is ‘real’ a span tag. Therefore, they will apply it like any other HTML tags, instead of showing it to your audience.

Principally, what we need to do in order to make the tags appear in our posts is making the tags not recognized as tags (by browsers). To do that, we need to write the tag mark ups of < and > with entities.

Entities are codes to draw certain characters in HTML programming. Changing tags mark ups of < and > will make the tags not recognized by browsers as tags. Therefore, the tags will be viewable to your readers.

The entity codes for < is &lt; and for > is &gt;

So, to show (in browsers):
<span style=”color: red”> The span tag will make this text red </span>
We need to write it as (in our post; before publishing it):
&lt;span style=”color: red”&gt; The span tag will make this text red &lt;/span&gt;
Pretty simple right? Yes, because it is only a one-line tag. How if the tags consist of 50 tags? That is the use of “How to Change Numerous Tags to Entities Easily

Any question?

1 comment:

Anonymous said...

very GREAT!

thanks!