HTML and CSS Reference
In-Depth Information
Handling content in the iframe element
The iframe element creates a box with a set width and height into which the external
document is loaded. It loads its content via a URL supplied to the src attribute. Like
object , content can be added between the opening and closing tags as a fallback
mechanism should the page be viewed by a browser that does not support inline frames.
While all major browsers support the iframe element, from an accessibility perspect-
ive, it is a good practice to add fallback content anyway. If nothing else, it can be used
like a comment to remind you what the linked resource is. Consider also including a
link to the embedded document so that the user has access to the document even if the
iframe is not supported. Here is an example:
<iframe src="embed.html" width="300" height="150">
<a href="embed.html">View embedded web page.</a>
</iframe>
If the previous snippet were viewed in a browser that did not support iframe , the
link would be displayed; otherwise, the contents of embed.html would be rendered
within the boundaries of an inline frame, which is a 300 pixel wide by 150 pixel tall
box (in this case, as set by the width and height attribute). Horizontal and vertical
scrollbars appear as needed to fit the content, as shown in Figure 5-3 .
Figure 5-3. Appearance of an inline frame with scrollbars
 
Search WWH ::




Custom Search