Home | All Questions | alt.html FAQ >

What is an iframe?

<iframe>'s are a mixed blessing. They're very easy as a means of including one html page in another, but they're often a bad way of doing it. You might like to look at SSI instead.

An <iframe> is entirely different to most frame-based sites. Frames are usually used as a means of page structuring; putting a repeated menu bar down the side etc.

<iframe> is used differently; as a means of embedding some "content" on a page of "padding". The content is separated either because it's big, and you want to be able to scroll it independently, or because it's dynamically generated and you want to embed it easily.

Obviously you can use either <frame>'s or <iframe>'s for both purposes, but this is a reasonable general view of them.

As a quick example, try the following.

Make a very dull page, with nothing on it other than a few <p> elements and some "news report items" in it. Call it news_content.html

Now make a simple container page:

<h1>My Newsfeed</h1>
<iframe src="news_content.html" >
<p>Here's the latest news</p></iframe>

See if that works for you. Then rework it with CSS or a <table> to control where the <iframe> is positioned. Use the <iframe>'s attributes to control its size.</p>

Recommended Resources


Related Questions