I need a page with a header and an iframe that show from other site.
here is what I use:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
*{margin:0;padding:0}
html, body {height:100%;width:100%;overflow:hidden}
table {height:100%;width:100%;table-layout:static;border-collapse:collapse}
iframe {height:100%;width:100%}
.header2 {border-bottom:1px solid #000;height:90px;}
.content2 {height:100%}
</style>
</head>
<body>
<table>
<tr>
<td class="header2">
asdasdasdasd
</td>
</tr>
<tr>
<td class="content2">
<iframe src="http://www.w3schools.com" scrolling="auto" frameborder="1" />
</td>
</tr>
</table>
</body>
</html>
problem is that this code do not show footer complete (90 pixels is out of page because of header part).
Tables are hurting my eyes. position: absolute
is seriously underrated for this. Try this layout instead:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Layout</title>
<style type="text/css">
body, html
{
margin: 0; padding: 0; height: 100%; overflow: hidden;
}
#header
{
position:absolute; left: 0; top: 0; right: 0; height: 90px; background: red;
}
#content
{
position:absolute; left: 0; right: 0; bottom: 0; top: 90px; background: blue; height: expression(document.body.clientHeight-90);
}
</style>
</head>
<body>
<div id="header">
Test content
</div>
<div id="content">
<iframe width="100%" height="100%" src="startdoc.html" />
</div>
</body>
</html>
Bonus points for rendering correctly all the way to IE6 and on every browser I've ever tested with minimal hacks :)
Make your header absolute positioned, so it overlays over the iframe, like so:
<table>
<tr style="position:absolute;top:5px">
<td class="header2">
asdasdasdasd
</td>
</tr>
<tr>
<td class="content2">
<iframe src="http://www.yahoo.com" scrolling="auto" frameborder="1" />
</td>
</tr>
</table>