Skip to content Skip to sidebar Skip to footer

Is It Possible To Display Only A Certain Div Within An Iframe?

Let's say i have an iframe with the page 2.htm set as the src. So this shows the 2.html. But 2.html has a div with the id 'within'. I wa

Solution 1:

This is the CSS and html code to accomplish the task:

<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="2.html" id="inneriframe" scrolling="no"></iframe>
</div>

Try this out: http://jsfiddle.net/57MRn/

How does this work
The iframe is moved up within the outerdiv until only the within div is shown.


Post a Comment for "Is It Possible To Display Only A Certain Div Within An Iframe?"