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>
If it is a static HTML site, create a new page with the content which you want to show and set the src of the <iframe> . If it is a dynamic page app (server side), create a new page or handler or controller (whatever applies) and set the src of the <iframe> .
HTML <pre> tag defines preformatted text. It is used to display code blocks since it preserves spaces and line breaks. If the line is large, then the <pre> tag won't wrap it by default. To wrap it, we need to use CSS.
You need to replace <
and >
with the respective entities <
and >
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With