View Full Version : How do I embed a page within a page?

Jan 11th, 2007, 12:46 AM
I was wondering how I could embed a page into another page. This is an example of what I'm trying to do: http://www.mark-tremonti.com/

As you can see, our good friend Mark Tremonti (guitarist of Creed/Alterbridge) has an embeded his page with a scrollbar. I want to know how to do this. I think it has something to do with the iframes tag, but I'm not sure.

Jan 11th, 2007, 12:57 AM
Hi there,

Indeed it has something to do with the iframe element. However, nowadays this has become somewhat bad practice for accessibility reasons. You can achieve that same effect with CSS now. For example:

<div style="width: 100px; height: 50px; overflow: auto;">(more content than the element can handle)</div>

This will give you a scrollbar (usually vertical) if the content exceeds the size of the element.

However, if you still wanna use inline frames:

<iframe src="page.html" width="100" height="50" scrolling="yes"></iframe>

The iframe is kinda like a "hole" in a web page where one can look through to other html pages. You create another html document with the content that belongs in the frame (that is supposed to be scrolled) and refer to it in the iframe tag. In my example you would have a page called page.html and refer to it in the iframe with the src attribute.