Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IFRAME width as percentage?

Status
Not open for further replies.

AlbertAguirre

Programmer
Nov 21, 2001
273
US
Is it possible to make an iframe width a percentage rather than a fixed width?
 
feherke, I tried that, does not work. Is this the standard for iframe widths? Is there something I am doing wrong?
 
Heres my code:
<iframe src="my URL here" SCROLLING="no" FRAMEBORDER=0 height="1500" width="100%" MARGINWIDTH=0 MARGINHEIGHT=0 style="background-color: #000000"></iframe>

This width setting above does not work. My iframe page dissapears
 
OH NO! never mind! I had the hieght set to 100% as well and thats what made my iframe dissapear.

Is there a way to make the height 100% too?
 
There might be, if you give the container where your iframe is a set height. Because height works in a way that if the parent element does not have specified height (basically is just tall enough to encompass everything that is inside it), then any element inside it that has height: 100%; will revert to height: auto;, which means the same as parent -- just enough to fit the text. And since iframe is empty before the page is loaded inside of it, it will be zero pixels high.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
If you want a frame that extends to 100% of the width and 100% of the height of your document, why not just use a regular <frameset> instead of an <iframe>.

In fact, why not just link to whatever document you have in the frame and miss out the frames altogether. It'll save you some faffing about.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top