Tuesday, March 27, 2012

How to Display HTML Tags on a Web Page

HTML Tags are used to write web pages. Usually after a HTML tag added on your web page, it will be executed. But at some special occasions, you may want the HTML tag code is shown as it is in a text editor. For instance, when you write a HTML tutorial online, you may need to show examples about how to use HTML tags by showing the original HTML codes. Here I am going to show you several ways to display HTML codes on your web page.

How to display HTML tags on a webpage
1. Use <pre></pre> tag. The HTML <pre> tag is used to define preformatted text. And it is also used for displaying some kind of computer code. Let me give you an example. If you want to show how to show text in bold using HTML <b> tag, you can show the original code as <pre><b>text</b></pre>.

2. Similarly, the <xmp></xmp> tag and the <textarea></textarea> may also do the job.

3. Another way to display HTML code on a webpage is to convert the < into &lt; and > into &gt;. If you need to convert a lot of code, you can use the find and replace function in the text editor or use online free HTML code converter.

So, it is not difficult to display HTML tags on a web page. What you need to do is just to use correct tools and do it in a correct way.

No comments:

Post a Comment

Search & Win