HighDots Forums  

changing the width / height of iframe's

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss changing the width / height of iframe's in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
yawnmoth
 
Posts: n/a

Default changing the width / height of iframe's - 11-13-2007 , 10:58 PM






http://www.frostjedi.com/terra/scripts/demo/iframe.html

The div "main1" is 250px tall and takes up as much width as necessary
to fill up the rest of the screen.

I would like the iframe "main2" to do the same thing. Any ideas as to
why I am unable to do so?


Reply With Quote
  #2  
Old   
yawnmoth
 
Posts: n/a

Default Re: changing the width / height of iframe's - 11-15-2007 , 11:42 AM






On Nov 13, 10:58 pm, yawnmoth <terra1... (AT) yahoo (DOT) com> wrote:
Quote:
http://www.frostjedi.com/terra/scripts/demo/iframe.html

The div "main1" is 250px tall and takes up as much width as necessary
to fill up the rest of the screen.

I would like the iframe "main2" to do the same thing. Any ideas as to
why I am unable to do so?
Setting the width as an attribute to 100% doesn't work because it'll
"spill over":

http://www.frostjedi.com/terra/scrip...o/iframe2.html

div blocks do this, too, however, div blocks take up the rest of the
width by themselves whereas iframe's do not seem to...

Any ideas as to what I can do to make "main2" take up all the width
after "menu" while, at the same time, still being on the right side of
"menu" (as opposed to underneath it)?


Reply With Quote
  #3  
Old   
Ben C
 
Posts: n/a

Default Re: changing the width / height of iframe's - 11-15-2007 , 04:19 PM



On 2007-11-15, yawnmoth <terra1024 (AT) yahoo (DOT) com> wrote:
Quote:
On Nov 13, 10:58 pm, yawnmoth <terra1... (AT) yahoo (DOT) com> wrote:
http://www.frostjedi.com/terra/scripts/demo/iframe.html

The div "main1" is 250px tall and takes up as much width as necessary
to fill up the rest of the screen.

I would like the iframe "main2" to do the same thing. Any ideas as to
why I am unable to do so?

Setting the width as an attribute to 100% doesn't work because it'll
"spill over":

http://www.frostjedi.com/terra/scrip...o/iframe2.html

div blocks do this, too, however, div blocks take up the rest of the
width by themselves whereas iframe's do not seem to...
It's because iframes are replaced elements. Even if you make the iframe
"display: block" it doesn't take up the full width-- see CSS 2.1 10.3.4.

Quote:
Any ideas as to what I can do to make "main2" take up all the width
after "menu" while, at the same time, still being on the right side of
"menu" (as opposed to underneath it)?
Use another container. But you still won't be able to get the width you
want because of the border.

Absolute positioning is also ruled out (it actually does "work" in Firefox,
but I think that's a bug-- according to 10.3.8 the replaced element's
used width is calculated like that of a replaced element even if it's
absolutely positioned).

There is a solution in browsers that already support the CSS3 box-sizing
property, which is actually Firefox (if you call it -moz-boz-sizing),
Opera, and possibly Safari:

<div style="overflow: hidden">
<iframe id="main2" style="border: 1px solid; width: 100%;
height: 250px;
-moz-box-sizing:border-box;
box-sizing: border-box">
</iframe>
</div>

Chances are it won't work in IE.

Overflow: hidden is to make the div a block formatting context which
means its left edge moves to the right of the float. This is something
the spec says browsers "may" do, but FF, Opera and Konqueror all do.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.