Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: iframe height

  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,456
    Thanks
    15
    Thanked 0 Times in 0 Posts

    iframe height

    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?

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

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Quote Originally Posted by esthera View Post
    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.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    330
    Thanks
    3
    Thanked 35 Times in 35 Posts
    how do I do this?
    This should do it:
    Code:
    <!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.
    Frank

    How to: Target IE in, Position in, Center in, Create a Fixed ('Sticky') Footer with, and Create a Drop-Down/Fly-Out Menu with CSS: Website Laten Maken Amsterdam.

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Quote Originally Posted by Frankie View Post
    This should do it:
    Hmm... Perhaps I misinterpreted the request (which seems pretty ambiguous to me on a re-reading).

    Quote Originally Posted by Frankie View Post
    Mind that you forgot quotation marks after .asp.
    Please mind that you use an iframe end tag.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • Users who have thanked Arbitrator for this post:

    nolvorite (10-30-2011)

  • #5
    Regular Coder
    Join Date
    Sep 2011
    Posts
    330
    Thanks
    3
    Thanked 35 Times in 35 Posts
    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.
    Last edited by Frankie; 10-30-2011 at 05:20 PM.

  • #6
    Senior Coder
    Join Date
    May 2004
    Posts
    1,456
    Thanks
    15
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •