I am trying to get an HTML entity to display to the page without showing up as the symbol it represents. EX: I want to have < show up on the screen instead of <. I am doing this inside of a code window that I created on my page to show how HTML entities are used in the code itself. Is there a way that I can do this in HTML and if so how would I go about doing this?
<pre> <code> < </code> </pre>
CodePudding user response:
To display HTML entities on a page, you can use the &#
notation followed by the entity's numerical code. For example, to display the 'less than' (<) symbol on a page, you would use the code <
. If you are including the code inside of a code window, you may need to use HTML character entities in order to prevent the browser from interpreting the code as a tag. For example, you would use &#60;
to display the 'less than' symbol.