Log in

View Full Version : iframe height 100% problem



Kimstahnke
08-13-2007, 09:04 AM
I am trying to get an iframe to size height to 100% but it keeps getting stuck on about 200 px in height. Also tried fx 80% with same result.

Is it at all possible to set the height of an iframe dynamically?

I have read quite a few comments about iframe such as "..dont use iframes..". Are these comments 'religious' or should I just avoid iframes for some reason?

My goal is to navigate a site from a menu, each page being displayed in a target iframe. But since the pages differ in content I get scrollbars if they are too large. I would rather have the iframe scale to include all content.

jscheuer1
08-14-2007, 04:34 AM
When you set the height of something to 100% it means that it will be 100% of the height of its container. It has nothing to do with the height of its content. There is a far from perfect script that you may or may not like for what you are doing:

http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

Iframes should be avoided by anyone intending their pages to be 'future proof', as it is slowly being phased out of the standards. It will be around for quite some time yet to come, perhaps forever, but there is no guarantee. Because it is no longer being written into future standards, its behavior will most likely always be a bit quirky in different browsers.

Personally, I have no problem with using it, but I recognize it is difficult to work with for the reasons just stated.

GodLovesDemeter
08-14-2007, 06:16 PM
If you know the exact content you need to display on your page including dimensions in pixels you could insert it into an I-Frame and absolute position it :Left:0px;top:0px; using the following.....
<div><iframe name=""src=""align=""frameborder="No" Scrolling="No"
style="position:absolute;top:0px;left0px;width:??px; height:??px;z-index:1;">
</iframe></div>

bsquared0
08-23-2007, 05:19 PM
Hi Global Moderator,

You seem to know iframes and I have used them as the content display on my site mcgymswim.com (http://mcgymswim.com). The only thing I have not been able to figure out is how to link topics to the iframe of the index pages when called from a link outside of the active directory. As an example, I would like to link the site map (located in Left Side Bar | Docs & Stuff | Web Site Map) to each topic in the assorted categories available in the left side bar menu.

Help is much appreciated as I'm a web newbie and this is my first site.

Regards - bsquared

Rohan72
08-24-2007, 09:18 PM
I have about the same problem with iframe

I have a 3x3 table with rounded corners and i would like to put an iframe in de middle td. I used the script previously mentioned, but the td always stays the same height, although i set the height of the td to 100%.

is there a way (script?) i can catch the height of the iframe and insert it in the table?

budiarto
09-26-2007, 09:09 AM
I have the same problem guys, I tried all the above codes , none working...

any inputs..?

Budiarto

insanemonkey
09-26-2007, 09:46 AM
try typiing in height="auto" and some browsers ignore auto and 100% like opera...

Sittan
07-08-2011, 06:39 AM
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iframe1</title>
<style type="text/css">
html{height:100%;}
body{height:100%;}
</style>
</head>

<body>
<iframe src="http://www.google.com" height="100%" width="100%" frameborder="0">
</body>
</html>