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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

POSITIONING AN IFRAME 1

Status
Not open for further replies.

SPYDERIX

Technical User
Jan 11, 2002
1,899
CA
How do you position an IFRAME x number of pixels from the top and y pixels from the side.

Here is the code I am using

<IFRAME SRC=&quot;MAIN.HTML&quot; NAME=&quot;IFRAME&quot; WIDTH=&quot;500&quot; HEIGHT=&quot;400&quot; FRAMEBORDER=&quot;0&quot;></IFRAME>

I know that to position a popup window you use screenx and screeny, so can you do this with an IFRAME, or do you just have to put it in a table and mess around with the table to position it properly? [deejay]
Nate
&quot;If you're not living on the edge, you're taking up too much space!&quot;
 
This is how I did it on my site:

<div style=&quot;position:absolute; left:137px; top:190px; width:563px; height:325px; z-index:1&quot;>
<iframe src=&quot;page.html&quot; height=&quot;100%&quot; width=&quot;100%&quot; name=&quot;right&quot; bottomscroll=&quot;no&quot; frameborder=&quot;0&quot;>
</iframe>
</div>

The sections in bold are the ones that handle the positing of the iFrame... I have not failed; I merely found 100,000 different ways of not succeding...
 
Thank-you so much, it worked ALMOST perfectly,

The reason I say ALMOST is because when you specify the width and height, it doesn't actualy display the correct width and height. To get a perfect square I had to use width=&quot;150&quot; and height=&quot;100&quot;.

Any suggestions on that one, (why is doesn't display the pixels correctly as specified)? [deejay]
Nate
&quot;If you're not living on the edge, you're taking up too much space!&quot;
 
OK, I figured it out and there is a slight change that I had to make to your code it is as follows:

<DIV STYLE=&quot;position:absolute; left:100px; top:100px; width:200px; height:200px; z-index:1&quot;>
<IFRAME SRC=&quot;about.html&quot; NAME=&quot;IFRAME&quot; WIDTH=&quot;200&quot; HEIGHT=&quot;200&quot; BOTTOMSCROLL=&quot;NO&quot; FRAMEBORDER=&quot;1&quot;>
</IFRAME>
</DIV>

your code in the <IFRAME> TAG had width=&quot;100%&quot; and height=&quot;100%&quot; i just changed them to be the same width and heiht as in the <DIV> tag.

But thanks so much, this is going to solve all my frame problems. I don't think I'll use taditional frames ever again. I like how the IFRAME layers itself over the page, so there is no problem with formatting its placement. [deejay]
Nate
&quot;If you're not living on the edge, you're taking up too much space!&quot;
 
Hey no problem...glad that it worked out...
Its strange that the 100% didn't work for you, it worked great for me... I have not failed; I merely found 100,000 different ways of not succeding...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top