If you still have other problems with the layout of Iframes, I found a nice trick for positioning the iframes.
The second example fixes the height-bug so it's sticky until the bottom of the page.
To get iFrames neatly layouted by CSS, try the following code:
For 2 horizontal iFrames (or a 2 column layout) next to each other with a fixed navigation and a flexible content page (100% stretched width), try using this:
HTML Code:
HTML:
<div id="leftcontainer">
<iframe id="leftframe" src="nav.html" name="nav" frameborder="0"></iframe>
</div>
<div id="rightcontainer">
<iframe id="rightframe" src="content.html" name="content" frameborder="0"></iframe>
</div>
CSS:
body {
margin: 0 auto; padding: 0;
overflow: hidden;
}
#leftcontainer {
width: 220px;
height: 100%;
display: inline-block; float: left;
}
#rightcontainer {
width: *;
height: 100%;
display: inline-block; float: left;
}
#leftframe, #rightframe {
width: 100%;
height: 100%;
}
----
For 2 vertical iFrames (or a 2 row layout) next to each other with a fixed navigation and a flexible content page (100% stretched height to the bottom), use this code below.
The fix contains a container wrapper and the frames must be positioned "absolute". To stretch the iframe to the bottom correctly, the padding-bottom needs to equal the amount of pixels of the navigation frame.
Without the container, the navigation-frame will dissappear when clicking a link. So that's why we need a container, positioned relative.
HTML Code:
HTML:
<div id="container">
<div id="topcontainer">
<iframe id="topframe" src="nav.html" name="nav" frameborder="0"></iframe>
</div>
<div id="bottomcontainer">
<iframe id="bottomframe" src="content.html" name="content" frameborder="0"></iframe>
</div>
</div>
CSS:
body {
margin: 0 auto; padding: 0;
overflow: hidden;
}
#container {
position: relative;
}
#topcontainer {
height: 200px;
}
#bottomcontainer {
height: *;
}
#topframe {
position: absolute;
top: 0px; left: 0px;
height: 200px; width: 100%;
}
#bottomframe {
position: absolute;
top: 200px; left: 0px;
padding-bottom: 200px;
height: 100%; width: 100%;
}
Bookmarks