4thSpace
4thSpace

Reputation: 44352

Why does iframe stop page rendering?

Why if an iframe is closed on its opening tag (short hand) does it stop rendering the page:

http://jsfiddle.net/8rUrf/

Stops rendering

<iframe src=""/>
<p>my text</p>

vs.

Works fine

<iframe src=""></iframe>
<p>my text</p>

Upvotes: 0

Views: 872

Answers (2)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324740

Because the <iframe> tag cannot be self-closing, any more than a <script> tag can.

Upvotes: 2

Quentin
Quentin

Reputation: 943936

HTML is not XHTML (and XHTML served as text/html isn't either). You cannot close arbitrary elements by ending their start tag with a / character.

The paragraph is considered to be inside the iframe (and thus is alternative content for browsers that don't support iframes) because you have not provided an end tag for it.

You may find it useful to perform some basic QA with a markup validator.

Upvotes: 2

Related Questions