Solved

iframe variable height not working

Posted on 2009-05-16
8
741 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now