HTML - How To Set An Iframe Height To % Or Variable?
I have a basic horizontal iframe with a persistent navigation header and a content page below which is the target for the navigation.
How do you set the height of the content frame to scroll if necessary depending on the amount of content on the page? The content pages that are swapped in/out and have varying heights. I would like the page height overall to include all content. Setting scrolling to "yes" in the <iframe> tag forces the content (framed) page height to about 100px(?), leaving a lot of dead space in the browser window below. Ideally the whole page would scroll as one, but I would settle for scrolling just the content (framed) page. Any help would be appreciated. Thx Similar TutorialsIs it possible to have an ifram at 100% height? I am embedding an iframe into my template so that I can have a forum within the template. Though the forum pages height changes and I wanted to set the iframe to 100% so that it will auto adjust. When I changed it to 100% it didn't work and it looks to be about 20 pixels high. Thanks, Nick I am using an iframe to insert some common text/links in several pages. I want the 'src' to take up just as much space (vertically) as it needs, without using scrollbars. My problem is that as time goes on, I may add, or remove things from the 'src'. I don't want to have to go back to the individual pages that have the iframe tag and re-adjust the height="xxx" bit. Is there a way to do this ? Hi, I am using an iframe in my website, and I don't know how I am supposed to get the height to be correct. The problem is, I am treating the iframe like a little portal to another site. So when the user clicks a link on the page that is in the iframe, the page in the iframe changes and so does its height. I cant set a fixed height obviously, and I tried using 100% but that didn't work either. Does anyone know what I can do? Thanks! I'm having a bit of trouble with an iframe. I'm wanting my iframe to automatically adjust to the height of whatever page loads into it. Is that possible? My code is as follows: HTML Code: <iframe src="test.html" name="_blank" width="656" height="100%"></iframe> I'm building all the page that should load in the iframe to be the proper width, but I was hoping to make the iframe automatically adjust to the height. Any help is greatly appreciated. Sorry, but I have another problem :/ http://cedarcreekyouth.org/photos.html iFrame on that page will not work size properly? The Situation: I'm integrating a forum into my website with an Iframe. I want it to look good and scrollbars just don't cut it. I was hoping to find a script that could decide the height of the iframe base on the contents of the contents. In short, I want the iframes height to change according to the forum. The Problem: I found a lot of scripts that accomplished this, but with one major problem in all of them. When you go to a link within the Iframe the height stays the same. So if the original page is short and the page its linked to is longer, it cuts off. The Site The Explanation: As you can see the script works nicely on the first page, but if you go to the post in the "Announcements" section the height stays the same and the post is cut off. Does anyone know of a dynamic iframe height script capable of resizing again every time a page is loaded inside the iframe? Hi All, I have an iframe in my page. I change its height from a button inside the iframe using javascript. for example: parent.document.getElementById('iframe').style.height="100px"; The problem is that if the iframe height was 500px for example, and I changed it to 100px then the whole iframe is shrink down. I mean that the 100px are the top 100px but they are appear in the button of the iframe and there are 400px empty at the beginning. Any Idea how to change it? Thanks in advance Please help me understand! I'm trying to create a page that has several static height table rows and one row that has an iframe that I want to expand to fill the height of the browser window. Here is a link to the test page: http://dl.dropbox.com/u/9536793/testWITHframe.html Here is the CSS used by the page: http://dl.dropbox.com/u/9536793/test.css Here is the page loaded into the iframe of the main page: http://dl.dropbox.com/u/9536793/testblankframe.html So, there are three rows at the top (Title, Menu, and Button rows). At the bottom are two rows (Bottom row and Copyright row). In the middle is the row that contains the iframe that I want to fill the page height. It works correctly in Firefox 4 and Chrome. However, in IE 9 (standards mode), the frame is too tall, so a scroll bar is added to the page and the bottom area is pushed off the end of the window. Bah IE!! If I take off the DOCTYPE, or use an older DOCTYPE, IE goes into Quirks mode, and then the page appears correctly (sort of). However, I'm trying to use HTML 5 rules, so I want to just use DOCTYPE html. I also need IE in Standards mode so that a charting tool that I am trying to use wiill work right. I just can't get all of the technologies to play together! Anyway, I know iframe are sometimes frowned upon, but we use a page layed out like this and then load various pages into the iframe based on what the user selects in the menu. I don't particularly like it either, but don't know a good alternative. (I'm open to suggestions for that as well). Any assistance with getting the height to fill the page (and no more) that will work in all IE (8 and 9 standards mode), FF, and Chrome would be appreciated. Thanks. Hi guys, First of all I'm a newbie at web coding and such... Using dreamweaver I managed to create a simple web design, Exactly as I wanted it. Now my only problem lies with the table and the iframe within it, Is it possible for the table to depend on the iframe's height and increase accordingly? (auto increase height and fill the whole frame page without scrolling inside the frame) Here is the code, maybe I did something wrong... <style type="text/css"> body { margin-top: 0px; } </style> <body bgcolor="#c7c7c7"><table width="1020" height="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <th width="20" height="100%" rowspan="3" scope="col"><img src="bgleft3.jpg" width="20" height="100%" /></th> <th width="980" height="277" background="Mainbanner.jpg" scope="col"></th> <th width="20" height="100%" rowspan="3" scope="col"><img src="bgright3.jpg" width="20" height="100%" /></th> </tr> <tr> <th width="980" height="51" background="Barnew.jpg" scope="col"></th> </tr> <tr> <td width="980" height="100%" bgcolor="#3e5d75"><iframe src="frame_new.html" width="100%" height="100%" frameborder="0" scrolling="no"></iframe> </td> </tr> <tr> <th width="20" height="46" background="BottomLeft.jpg" scope="col"></th> <th width="980" height="46" background="BottomNew.jpg" scope="col"></th> <th width="20" height="46" background="BottomRight.jpg" scope="col"></th> </tr> </table> </body> Thanks in advance. (Already tried google and searched the forums, didnt find anything) Hey. I am using iframe inside my site, but i have to choose width and height myself.. when i set it to auto, i still have to scroll. Heres my site: http://habbxtra.net HTML Code: <iframe src="hjem_frame.php" width="450px" height="1200px" name="mainframe" frameborder="0" scrolling="no"</iframe> Ive tried changing height to auto and not setting a height at all, and setting the height to 100%, but when i change to 100% in width it wont show, and when i chane haight to 100% it doesnt do anything, just the same as width auto. Thanks for any reply ! Hello. I have a flash header on my page with links. When each link is pressed, the appropriate .html page is loaded into the iframe, which i have defined with this code: Code: <iframe name = "mainframe" src="home.html" width="746" height="800" frameborder="0" align="middle"> The problem is, the different pages that will be loaded into 'mainframe' have different heights, and i would like the iframe to adjust to these heights without adding scrolling bars. How would I do this? I don't know if this question is posted somewhere, but I can't seem to find the answer I'm looking for. I'm currently using iframe for my posting entries, and I can't figure out the script for auto height. I'm tired of setting the height by hand, every time my entries starts to stretch. Now regarding the width, would that be possible too? if not, I'm not too concerned. Most important is the height. If anyone have the answers to this please reply. Thanks in advance! (: Hello there, I am pretty new to web programming. I am currently having problem with Iframe's height. here's what happen. I have a page with 2 Div. First div is the header with menu. The 2nd Div Contains 2 Iframes. The first Iframe is my title bar location, and the 2nd iframe is my content location. The menu and title bar location is fine. When I click on something from the menu bar, it changes both the title bar and the content page. I did it like this because I don't want my title bar to scroll up when my content page is longer. So here's my problem: for the 2nd Iframe which contain my content, I couldn't set the height properly so it will fill and extend to the bottom of the screen when resolution is high. Also i don't want a scroll bar to the whole website, but only to the 2nd iframe. here's an example. I made a very simple version of what is exactly my problem. So is easier to read on the forum. index.html's 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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body scroll="no"> <div id="apDiv1" scrolling="no"> <p>This is a test.</p> <p>This is a test.</p> <p>This is a test.</p> <p>This is a test.</p> <p>This is a test.</p> <p>This is a test.</p> </div> <div id="apDiv2" scrolling="no"> <iframe src="123.html" style="position:absolute; width:780px; height:35px; top:240px;" scrolling="no"> </iframe> <iframe src="abc.html" style="position:absolute; width:780px; height:100%; top:275px;" scrolling="yes"> </iframe> </div> </body> </html> 123.html's 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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> 1234567 </body> </html> abc.html's 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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> <p>TEST</p> </body> </html> Notice, I have a long TEST there. because i want only the iframe to scroll, but not the whole website. Anyone know a solution to this? For my layout I've got a div content and several others inside it. HTML Code: <div id="content"> <div id="box1"> <h1>Portfolio</h1> </div> <div id="port"> sample text </div> <div id="port"> sample text </div> </div> And that's the css for it Code: #content { float: right; width: 540px; margin-right: 40px; margin-top: 20px; height: 100%; } What goes inside the div "content" varies for each page, so I want to make the content with variable height, but I can't! When I preview the page its shows the "content" being overlapped by what's inside it. It may be something very simple (still learning) but I can't see what is wrong. Can someone help please? Many thanks! Hi, I have what I think is a simple problem, but I am not sure how to solve it (because I am fairly new at php): I want to use a google map link where it will show the destination address. This link uses the iFrame component. Now, on my site, I want the user to enter his/her departing address, and what is entered will be input into a php variable $address. I am still experimenting, but I wanted to replace the google link that is in the iFrame (say it is www.googlemaps.com/location1+location2+location3) I want to replace "location1" with $address. The thing is, when i try to put a php variable inside an html coding, it won't work. I am trying to integrate it without having to use <?php ?>, but rather in the body of the html. I also tried <?=$address?> but this also did not work. Could anyone help me out? it seems very simple. Hi, am trying to show a page in a HTML <iframe> but before loading that page I want to set a variable value. I tried following: <iframe src="slgrid/ccustomer.php?id=" <? echo $cat; ?> "width="100%" height="100""></iframe> but can not get the value of id using $_GET['id'] Any other ideas are also welcome please. I am a little new in PHP and HTML. Any help in this regard will be appreciated. Thanks and regards, Hi Everyone, I'm slightly confused by this one. But i'm sure theres a hack out there to fix it. Basically, in firefox and konqueror, running on kubuntu, the top navigation bar at http://www.tendervendors.com/dev/payroll.html displays correctly, and when you hover over it, it fills the li with a semi-opaque background. This is correct. Its done, by filling the a element, with a background-color and then applying opaque: 0.5; The a element also has padding, which makes it fill out to the size of the li element, so the a element fills its portion of the ul, and looks like the li has the affect applied to it. However, in opera, the right and left padding is correct, but the height padding doesn't work. Does anyone know of a bug in opera that would be causing this problem, and possibly a code fix for it? TIA Matthew Millar I have 2 IFrames on a page. I am going to end up with a long list of shows to catch-up on. Is there a way I can embed an IFrame with the list, and when you click on a show, you it will change the Playing Show http://tiny.cc/catchup <---The page I am referring to. |