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. We did this in order to correctly display the information above.
We came across this issue when we were writing another post dealing with the list-style attribute and working with <ol>, <ul>, and <li>. How do we actually show this on the website itself? We have to encode it. So we looked up the html encoding translations and found this answer.
We'll be sure to add to this list should we come across different encodings that we need to use for this purpose.
Recent Blog Posts