I want to display a title with arbitrary content above the iframe, which occupies the rest of the screen. I managed to get this working with tables using the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
html, body, iframe, table, tr, td {
margin: 0; padding: 0;
}
html, body, iframe, table, #content {
height: 100%; width: 100%;
}
table {
border-collapse: collapse;
}
iframe {
border: 0;
}
</style>
</head>
<body>
<table>
<tr><td>
<div id="header">
<p>some arbitrary stuff in a header</p>
<p>this is sized dynamically</p>
<p>it not a fixed size</p>
</div>
</td></tr>
<tr><td id="content">
<iframe src="http://www.bing.com/search?q=stackoverflow" />
</td></tr>
</table>
</body>
</html>
This works in Firefox and Chrome, but not in IE7 (I don't know why). Without using tables, this is the closest I could get:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
html, body {
margin: 0; padding: 0;
height: 100%;
}
iframe {
margin: 0; padding: 0;
width: 100%;
border: 0;
}
</style>
</head>
<body>
<div id="header">
<p>some arbitrary stuff in a header</p>
<p>this is sized dynamically</p>
<p>it not a fixed size</p>
</div>
<iframe src="http://www.bing.com/search?q=stackoverflow" />
</body>
</html>
This looks the same in all browsers, but the iframe is too short. If I set its height to 100%, then it would increase to the screen size and two scroll bars would appear (the same as IE7 in the table). I want the iframe to take up all the free space in the browser window, but no more. I would prefer not to resort to Javascript.