Solved

iframe variable height not working

Posted on 2009-05-16
8
745 Views
Last Modified: 2012-06-27
i just cant get my iframe to varry dependant upon the source.

    <iframe name="myframe" width="100%" height="100%" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no" overflow="visible"  src="/includes/iframes/jewellery_00.php"></iframe>

i think instaead of showing the whole frame ie 100% its showingonly as 100px... any ideas why??
<p><a target="myframe" href="/includes/iframes/jewellery_00.php">IFRAME ONE</a>
        <br/>
        <a target="myframe" href="/includes/iframes/jewellery_01.php">IFRAME TWO</a>
        <br/>
        <!-- DEFAULT IS IFRAME ONE -->
    </p>
    <iframe name="myframe" width="100%" height="100%" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no" overflow="visible"  src="/includes/iframes/jewellery_00.php"></iframe>

Open in new window

0
Comment
Question by:ilike-centre
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 29

Expert Comment

by:Badotz
ID: 24406083
100% of what? Set the width/height of the <body> tag and see if that helps (you get 100% of something that way).
0
 
LVL 12

Expert Comment

by:Chad Haney
ID: 24456710
The way you are setting it will only allow pixels.  You need to utilize css on an iFrame in order to be able to use 100%.


<style type="text/css">
html, body, .myframe{
width:100%;
height:100%;
}
</style>
 
<p><a target="myframe" href="/includes/iframes/jewellery_00.php">IFRAME ONE</a>
        <br/>
        <a target="myframe" href="/includes/iframes/jewellery_01.php">IFRAME TWO</a>
        <br/>
        <!-- DEFAULT IS IFRAME ONE -->
    </p>
    <iframe name="myframe" class="myframe" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no" overflow="visible"  src="/includes/iframes/jewellery_00.php"></iframe>

Open in new window

0
 

Author Comment

by:ilike-centre
ID: 24468685
this didnt work :-(
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 12

Accepted Solution

by:
Chad Haney earned 500 total points
ID: 24469039
Just tested with this and it worked.
<html>
<head>
<style type="text/css">
html, body, .myframe{
width:100%;
height:100%;
padding:0px;
margin:0px;
}
 
</style>
</head>
<body>
<iframe class="myframe" src="http://www.google.com"></iframe>
</body>
</html>

Open in new window

0
 

Author Comment

by:ilike-centre
ID: 24469111
ok, cool.
i'll try that tomorrow evening.
FYI if you have a look at my website http://www.ilike-centre.com/jewellery00.php you'll see that the iframe is part of a much larger php code.

i see that your creating a css - i tried that kinda. i created a style sheet called myframe. at set those attributes. the firstly added a class to the iframe = didnt work, then a style to the iframe = didnt work, then a <p style....> to the iframe = didnt work.
But i shall give it try with your method, i probably missed something.

Have a look at my website you'll see what i mean.
thank you for your help. i am really struggling to work this out.... i have no idea why all the litreature i am reading say all i need to do is give the iframe a height in either a % or px andthats it. but when i do it... it doesn work.
0
 
LVL 29

Expert Comment

by:Badotz
ID: 24469150
An <iframe> is a really a separate window. As such, you cannot reliably style it from the outside. But you *can* include CSS within the content of the <iframe> window, and perhaps this is part of the problem you are having..
0
 

Author Closing Comment

by:ilike-centre
ID: 31582291
thank you
0
 
LVL 5

Expert Comment

by:paogiver
ID: 30087386
<html>
<head>
<style type="text/css">
html, body, .myframe{
width:100%;
height:100%;
padding:0px;
margin:0px;
}
</style>

</head>

<body>
<iframe class="myframe" src="index.html" frameborder="0" scrolling="no"></iframe>
<iframe class="myframe" src="about.html" frameborder="0" scrolling="no"></iframe>
</body>
</html>

when i tried adding two iframe, it wont work, the first one didnt show fully
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question