PDA

View Full Version : iframe height



esthera
10-29-2011, 09:35 PM
I have an iframe that doesn't have a set height but I want it to take the height of the page and not scroll

how do I do this?


<iframe src="productatributes.asp width="100%" height="100%" scrolling="auto" frameborder="0">

Arbitrator
10-30-2011, 04:55 AM
I have an iframe that doesn't have a set height but I want it to take the height of the page and not scroll

how do I do this?As far as I know, this is not possible unless you know the size of the iframe content document.

There's a new HTML5 attribute for the iframe element called seamless that I expect would allow you to do this, but it seems that no browser supports it yet.

Frankie
10-30-2011, 09:09 AM
how do I do this?
This should do it:


<!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>
<title>Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
iframe {
position: absolute; /* sometimes necessary */
}
</style>
</head>
<body>
<iframe src="productatributes.asp" width="100%" height="100%" scrolling="auto" frameborder="0">
</body>
</html>


Mind that you forgot quotation marks after .asp.

Arbitrator
10-30-2011, 12:09 PM
This should do it:Hmm... Perhaps I misinterpreted the request (which seems pretty ambiguous to me on a re-reading).


Mind that you forgot quotation marks after .asp.Please mind that you use an iframe end tag. :)

Frankie
10-30-2011, 05:15 PM
Please mind that you use an iframe end tag.
I didn't. I just didn't see that Esthera had also forgotten to close the iframe tag. Which should indeed be done. :)

esthera
11-04-2011, 04:37 AM
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
iframe {
position: absolute; /* sometimes necessary */
}

that causes me to lose scrollbars on the page containing the iframe so won't work as they need to be able to scroll