tags:

views:

37

answers:

2

I have the following scenario:-

In an html page, display a top bar followed by another html page included dynamically on to the lower part of the page (for which I've used an Iframe). So, scroll bars for the window as such should not come up. Instead, a scroll bar for the included page should come up. I could do this using an overflow: hidden property on the body of the page.

But now, inorder to achieve this, i had to set the height of the iframe to 100% so that the page looks seamless. The problem with this is that the lower div which conatins the iframe flows out of <body> of parent and since I've given an overflow:hidden to the body, it cuts off the last bit of every included page. How do I overcome this?

The code :-

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Show Asset</title>
    <style>
    html, body, iframe
    {
        height: 100%;
    }
    body
    {
        overflow: hidden;
        margin: 0px;
        }
    iframe
    {
        width: 100%;
        margin: 0px;
        border: 0px;
        padding: 0px;
        }
    .optionsBar
    {
        background-color: Lime;
    }
    .iframeHolder
    {
       /* height: 100%;*/
    }
    </style>
</head>
<body>
<div class="optionsBar">Test</div>
<div class="iframeHolder">
    <iframe frameborder="0" scrolling="auto" src="http://en.wikipedia.org/wiki/Main_Page"&gt;&lt;/iframe&gt;
</div>
</body>
</html>
A: 

If i'm understanding the problem correctly this might fix it, however i'm not sure I am.

iframe {
border:0 none;
margin:0;
overflow:visible;
padding:0;
width:100%;
}
runrunraygun
no, here the problem is that the Iframe is overflowing out of the body.
Ajay
A: 

You can do it with box-sizing. See this question for example.

Unfortunately IE6-7 doesn't support this property, so for that browser the only way forward is to add a JavaScript onresize handler to sniff the height of the window (document.documentElement.clientHeight assuming Standards Mode) and set the iframe height to that minus the size of the bar.

bobince
the functionality that i need is the same as that shown by google image results page(the page that u get on click of an image result). This page doesnt seem to have a javascript running on resize. How is it possible without that? Also, that page is rendered in Quirks mode. How (and will that) make a difference?
Ajay
Ah, yeah, that's currently using a table layout and relying on Quirks Mode to ensure the second row's cell is the full height of the row (the remainder of 100% page height after the top bar is taken off). It's not quite possible to reproduce this in Standards Mode today: in Firefox and WebKit you can set the `<td>` height to `100%` and it picks up the height of the row, but in IE and Opera it takes the whole table height so you get the overflow.
bobince