+ 2
I'm looking for the best way to show html-tags as text in a HTML document.
Hi, everone, I'm looking for the best way to show html-tags as text in a HTML document. Like how to show ' <p> I'm a paragraph</p>' as text, without the html tags disappear, in a html document. Thanks to taking the time to helping me. wanna.be/webdesigner :-) ! Keep coding!
3 Respostas
+ 6
In order to use such characters, you need to use escape characters. <p></p> would be written as:
& lt;p& gt; </p& gt;
I had to add a space between the & symbol and the two letters as it just reverts to normal angled brackets so remember to remove the spaces when testing.
+ 6
You can do that with javascript.
For example, if you wan to write "<test>Hello</test>" in the element with id "me", use:
document.querySelector("#me").innerText += "<test>Hello</test>";
+ 1
You can use <code></code> attribute