0

I have a plain <p> tag in my HTML. Inside this HTML tag I am trying to output text as follows:

Place this code tag in the header of your website between <head> ... </head> in your page to show the notice to activate the functionality.

When I put this text inside the <p> tag as follows:

'<p>Place this code tag in the header of your website between <head> ... </head> in your page to show the notice to activate the functionality.</p>'

I render this wrong output:

Place this code tag in the header of your website between  ...   in your page to show the notice to activate the functionality.

As you can see the output did not print the ' head ' part. How can I fix it?

j08691
  • 204,283
  • 31
  • 260
  • 272
Dennis Kozevnikoff
  • 2,078
  • 3
  • 19
  • 29
  • Does this answer your question? [How to ignore tags within a paragraph?](https://stackoverflow.com/questions/68811134/how-to-ignore-tags-within-a-paragraph) – Decapitated Soul Aug 20 '21 at 18:49

2 Answers2

4

Convert the < and > into the entities &lt; and &gt;. See also https://dev.w3.org/html5/html-author/charref

Example:

<p>Place this code tag in the header of your website between &lt;head&gt; ... &lt;/head&gt; in your page to show the notice to activate the functionality.</p>
j08691
  • 204,283
  • 31
  • 260
  • 272
1

To escape a character in html you need to use the ASCII value of that caracter so for the < and the > this is &#60; and &#62;

<p>Place this code tag in the header of your website between &#60;head&#62; ... &#60;/head&#62; in your page to show the notice to activate the functionality.</p>
Joyescat
  • 507
  • 5
  • 11