Show HTML Code On Web Page

Richard CummingsBlogging, Quick Solutions, Technologies/SolutionsLeave a Comment

When you write about technology, you often have to show HTML code on a Web Page such that the code does not get executed.  But, more importantly for those involved in SEO, you may need to show HTML code on a Web Page to enhance the way that you do your job.  In this article, we will quickly explore the easiest way to show HTML code on Web Pages…and not have the code execute.

When you do web page promotion for yourself or your clients, you are often called upon to put in the source code of a link (the A HREF syntax) rather than the WYSIWIG version of the link.

For example, in the article I just wrote called Replace Comma with Line Break (this is a WYSIWIG link), I may need to refer to the HTML source code for that link if I wanted to promote that article (which I won’t promote, but if you want to link to it, I accept).  The HTML source code for that link looks like this:  <a href=”https://richardcummings.info/replace-comma-with-line-break/”>

The problem with showing the HTML source code is that it will get executed if you place it within the HTML code of your document.  For example, since I do a lot of site promotion for clients, I store all of my links in a database and then output them with a php file.   However, the A HREF output will always appear in WYSIWIG form if I do not make alterations.  Or, if I want to illustrate php syntax, it will get executed since I use a WordPress Plugin called Exec-PHP, which I recommend to everyone for implementing PHP within WordPress.

Fortunately, the solution is a simple one.

You need only refer to the page entitled Special ASCII HTML Character Codes.  When you want to Show HTML Code On Web Page, just replace the HTML code (for example the leading “<” in all A HREF syntax) with the ASCII character.  This is an easy process, especially with the ultimate Text Editor UltraEdit, a program that should be in everyone’s SEO ToolBox.  AND, you do not to replace every symbol within the line.  More often than not, you can get away with simply replacing the first line of the code.  In the case of A HREF, that would be the first bracket, or less than symbol, which i ASCII code looks like this:  &#60;

I especially like the list of Special ASCII HTML Character Codes listed above because the page offers both a Friendly Code and a Numerical Code, both of which you can use in your HTML code.

One other option to Show HTML Code On Web Page is with the HTML textarea element.  With this HTML code, you can create those little text boxes that you often see on web pages that look like this:

This is useful in some instances.  More information can also be found at W3Schools on their page called HTML TextArea Tag.

Show HTML Code On Web Page: Summary

The first time that you try to show HTML Code on a Web Page, you may be startled to find out that the code does not show, it gets executed! And, then you think, but of course it gets executed!

For me, the list Special ASCII HTML Character Codes saves the day everytime…especially since I often write php programs that output A HREF links. Most of the time, I can simply replace the bracket or minus sign (<) with &#60; and I am all set.

In other situations, you may find that the HTML textarea element serves you well when you need to display HTML code on a web page.

For instance, you may want to say, “if you liked this article, link to it by copying and pasting the following into your HTML code:

🙂 Hope this article helped you all out. Cheers, Richard

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.