Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

iframe variable height not working

Posted on 2009-05-16
8
Medium Priority
?
757 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Accepted Solution

by:
Chad Haney earned 1500 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
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 …

618 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