CSharpBeginner CSharpBeginner - 4 months ago 9
HTML Question

iframe element hide my page below

I have a simple html page with iframe and text.

Why I cant see the text: "Test" inside

<p>
element?
What I'm doing wrong at my .html file?

When I removed the
<iframe>
elemnt i can see "Test"

<html>
<head>

</head>
<body>

<p align="right">
<iframe id="serviceFrame" src="http://www.cnn.com" width="100" height="52" frameborder="0"/>
</p>

<p align="left">
Test
</p>
</body>
</html>

Answer

You cannot use self-closing (<iframe ... />) tags with an iframe.

The / at the and is ignored and the <iframe> tag is still open, so your <p> tag is within your iframe.

You need to correctly close your iframe and use </iframe>

Comments