Solved

iframe variable height not working

Posted on 2009-05-16
8
748 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
Independent Software Vendors: 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 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Session on Html 8 54
Flex container in CSS 8 44
CSS overflow problem 21 39
Add Rows on a Table 8 48
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.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

739 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