Search code examples
htmliframepre

<pre> tag won't show text containing <iframe>


Why can't I show my <iframe> code line inside a <pre>? I need to show this <iframe> code on a page for people to copy/paste. When I write it within a <pre> tag, it just renders the actual iframe object, rather than outputting the iframe code as text on the page.

<pre>
    <iframe height="150" width="150" src="http://lorem.com/text.html"></iframe>
</pre>

Solution

  • You need to replace < and > with the respective entities &lt; and &gt;.