Solved

iframe variable height not working

Posted on 2009-05-16
8
740 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

757 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

22 Experts available now in Live!

Get 1:1 Help Now