Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set the size of an IFRAME

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all,
I'm using IFRAMES linked to html, htm or xml files. I want to adjust the sizes of these IFRAMES according to the sizes of the documents. How can I do that? The "style='width:100%'" works fine...but what about the height? I cannot make it working. Has someone a solution?
thx
david
 
You can use:

<iframe src=&quot;x.htm&quot; width=&quot;100%&quot; height=&quot;100%&quot;>
</iframe>

or:

<iframe src=&quot;x.htm&quot; width=&quot;100px&quot; height=&quot;100px&quot;>
</iframe>

it works in IE 5

If you go to you can edit your own HTML code, to see if it works..
 
My problem is when I'm using &quot;%&quot; with the height nothing is displayed. If I'm using pixels it works. That's very strange.
 
In fact, the problem is that if you use &quot;%&quot; and if the page where you display the iframe is not enough big, the scrollbars won't work. Because, the window doesn't know the size of the Iframe...and it's not the case when you use pixels...because the window knows the size.
If someone has the solution he's of course welcomed.
thx
david
 
This will work for you:

<DIV STYLE=&quot;position:absolute; left:100px; top:100px; width:200px; height:200px; z-index:1&quot;>
<IFRAME SRC=&quot;file.html&quot; NAME=&quot;IFRAME&quot; WIDTH=&quot;200&quot; HEIGHT=&quot;200&quot; BOTTOMSCROLL=&quot;NO&quot; FRAMEBORDER=&quot;1&quot;>
</IFRAME>
</DIV>
Make sure you set the width the same in both <DIV> nad <IFRAME> tags, and the same for Height. You can also specify the placement of where you want the Iframe on the page.

Hope this helps. [deejay]
Nate
&quot;If you're not living on the edge, you're taking up too much space!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top