
Originally Posted by
vpdigital
Sorry for my bad terminology!
It's OK.
However, I do think it illustrates how important correct usage can be.
If you're not sure of the proper way to describe something, there's always a sure solution: post a link to a minimal example. Just enough code to show relevant parts of the problem). That way, a reader simply needs to activate that link and bingo! - they can inspect the problem for themselves. As the saying goes: "a picture is worth a thousand words".
Layers is another term (invented by Macromedia) that is thrown around too much. A "layer" could realistically be any positioned element, so it's generally better to say "an absolutely-positioned div" or similar. Again, it just avoids confusion (and annoying "buzz" words).
In Internet Explorer, the iframe looks much smaller (in width and height)!
As usual, IE is being a pain in the ass.
When you specify values for the left/right or top/bottom properties, the width or height should be calculated to take up the intervening space. If a child then specifies 100% width or height, it should use the computed value (as Mozilla, Opera, and other compliant browsers do). IE doesn't.
To achieve what you want, you'll have to set explicit values for the containing element (the div). As the use of px (pixel) units should generally be avoided, you'd probably be better off using percentages. However, as you haven't presented exactly what you're trying to produce, I might be wrong.
IE compounds this problem with its strange treatment of the height property. It's usual behaviour is, at best, unusual, but if a value is specified as a percentage, the containing element must have an explicit height. I really do hate IE...
I've added borders purely so you can see the position of both element clearly.
Code:
#main-section {
border: 1px solid blue;
position: absolute;
left: 20%;
width: 60%;
/* You could probably get away with using
* absolute units (preferably em) for the top
* property as vertical scrolling isn't so bad
* as horizontal. Still, be careful.
*/
top: 10%;
/* As I mentioned above, this property will
* have to be explicit. Again, the em unit is
* preferred.
*/
height: 25em;
}
#main-section iframe {
border: 1px solid red;
height: 100%;
width: 100%;
}
HTML Code:
<div id="main-section">
<iframe frameborder="0"></iframe>
</div>
Hope that helps,
Mike
Bookmarks