Phate01 Phate01 - 11 months ago 66
HTML Question

What tags can be nested inside an iframe?

I have the following code

<div class="fluid-container">
<iframe id="iframe" src="" style="width: 100%;">
<div>Your browser does not support iframes.</div>

Visual Studio (2015) says through a warning

Element 'div' cannot be nested inside element 'iframe'.

I also tried with
with the same results. I also try to google the error and looking for the answer but I didn't find anything.

So what tags can be nested?

Answer Source

From the spec:

When used in HTML documents, the allowed content model of iframe elements is text, except that invoking the HTML fragment parsing algorithm with the iframe element as the context element and the text contents as the input must result in a list of nodes that are all phrasing content, with no parse errors having occurred, with no script elements being anywhere in the list or as descendants of elements in the list, and with all the elements in the list (including their descendants) being themselves conforming.


a abbr area (if it is a descendant of a map element) audio b bdi bdo br button canvas cite code data datalist del dfn em embed i iframe img input ins kbd keygen label map mark math meter noscript object output progress q ruby s samp script select small span strong sub sup svg template textarea time u var video wbr text

Since you said span threw the error, you appear to have found a bug in VS.