Positioning pages within iframes

Let’s say I don’t want the whole page of an iframe. Let’s say I just want to grab the news box of Yahoo’s page…

There’s a great tutorial here.

You just want to trick the browser into only showing a window of the iframe and then loading the whole page behind the window. So the user only sees through the window at exactly what you want them to look at.

Below you can see the news section of yahoo:

And here’s the code:
<style>
#outerdiv
{
width:446px;
height:246px;
overflow:hidden;
position:relative;
}

#inneriframe
{
position:absolute;
top:-412px;
left:-318px;
width:1280px;
height:1200px;
}
</style>
<div id='outerdiv '>
<iframe src="https://www.yahoo.com/" id='inneriframe' scrolling=no >< /iframe>
</div>

It doesn’t work on every browser, but webkit and gecko work as usual.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.