To display HTML tags in a website, use their HTML encoding translation.
- Replace the < character with <
- Replace the > character with >
- Replace the & character with &;
You don't actually have to encode the ">" character. That one will show as long as you encode the "<" character. So, you can write <div> without encoding the > as > and it will show like <div> when you write it. The & character you may have to escape in order to show the encoding of other characters. I did this in order to correctly display the information above.
I came across this issue when I was writing another post dealing with the list-style attribute and working with <ol>, <ul>, and <li>. I was like crap, how do I actually show this on the website itself. Damn, I have to encode it. So I looked up the html encoding translations and found this answer.
I'll be sure to add to this list should I come across different encodings that I need to use for this purpose.
Recent Blog Posts