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!

iframe problem

Status
Not open for further replies.

VBmim

Programmer
Jun 25, 2001
361
BE
Hello all

I have a problem and it-is-driving-me-NUTS!!!

I have an IFrame which shows an asp page that builds up a simple table. The problem is that there is a quite deal of white-space before and after the table. I'm trying to get rid of that white-space and did all of the following

* iframe property height: changing it has no effect at all (no bigger, no smaller), I tried both percentages and normal values
* iframe properties hspace, vspace = 0 : no effect
* iframe property style="top:0px;bottop:0px;position:relative" : no effect. without 'position:relative' the white-space on the bottom of the table is huge (I would say about a 250 px).
* in the asp, body properties bottommargin=0 topmargin=0: I had a little effect here, the 'before' space became a little smaller, but the 'bottom' space became bigger...

Is there any way to adjust an iframe's height property to it's content? What am I doing wrong?

Tnx in advance

Greetz

VBMim
 
the iframe's height and width should be set to 100% and you would only need to change the dimensions of the container (probably a table cell);

to see where the problem is, make the background of the page in the iframe of a color and the background of the table cell in which the iframe is neste of another color. then inside the page of the iframe create a table of width 100% and height 100% and set a border for it too.

now you will easily see where is your problem.

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Hello

Thanks for the fast response!

The iframe is in a table cell allready, but it's not alone...

it's build like this:
<table>

<tr>
<td>some title stuff here</td>
</tr>

<tr>
<td><div>some more stuff</div><div><iframe></iframe></div></td>
</tr>
</table>

The idea with different background colors is a good one, but I used something else... i set the frameborder of my iframe to 1. There I could see that the whitespace is within the iframe, in the asp I'm showing.

Greetz

VBMim
 
Lets review your ideas:

iframe property height: changing it has no effect at all (no bigger, no smaller), I tried both percentages and normal values
Iframe height does not influence things inside the iframe. If content inside the iframe will be bigger than iframe, scrollbar will appear. Other than that, height has no implications on the content.

* iframe properties hspace, vspace = 0 : no effect
Iframe has no hspace and vspace properties.

* iframe property style="top:0px;bottop:0px;position:relative" : no effect. without 'position:relative' the white-space on the bottom of the table is huge (I would say about a 250 px).
This again influences the iframe itself and not the content. Top and bottom only refer to the distance from the edge of the container to the iframe. Position relative should have no known implications. All three do not touch the contents of the iframe.

* in the asp, body properties bottommargin=0 topmargin=0: I had a little effect here, the 'before' space became a little smaller, but the 'bottom' space became bigger...
I am not anymore familiar with this outdates technique of setting the margins, but I have tried the css solution and it worked for me. In the body tag of the asp file do this:
Code:
<body style="margin: 0; padding: 0;">
This removes all the margins in the iframe for me. However, if your table is not long enough to fill the entire iframe, then you will get whitespace at the bottom. Unless you have height="100%" property in your table. Hope this sheds some light.
 

Vragabond said:
Unless you have height="100%" property in your table.

I didn't think that giving a table a height of 100% made it fill up the entire height of its container... Although saying that, I've never tried it where the container is an iframe.

Dan
 
Hello everyone

Mim again has not woken up completely this morning...

I noticed a tiny little function getHeight.
Code:
function getHeight() {
return Table1.clientHeight +60;
}
When changing '60' into '20' --> miracle! the whitespace is smaller!

I have to add to my defence that the app was not originally written by me, and I had to work my way through dozens of variables all named 'temp' or 'tmp'. This makes things sometimes a little unclear...

Anywho, thanks for your time on this!

Greetz

VBMim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top