smumpkins Posted April 17, 2008 Share Posted April 17, 2008 Okay, I was just curious if anyone would know how to take a site that's in an iFrame and position it to a specific part of the page on load. For example: Let's say I want to code my personal site so that a gaming site comes up, and I want it load in my iframe (already setup to load the page in it), but I want it to load in a specific spot of the page (such as: left="20px" top="30px). Is there any way to do this, when you're using a 3rd party site within the iFrame? Here's the coding that I've been using (site swapped out for example.com) <iframe width="597" height="181" src="example.com"></iframe> Also, there are no styles in my header, but I could do that if necessary - though it's not worked thus far. Any ideas on how to position the page to specific coordinates upon load? Quote Link to comment Share on other sites More sharing options...
Matt Posted April 17, 2008 Share Posted April 17, 2008 Heh. I'm no expert, so don't take my word as gospel truth, but I'll give it a shot. It certainly wouldn't be the cleanest approach, but try putting the iframe in a <div> tag? Something like: <div style="left:20;top:30"> <iframe width="597" height="181" src="example.com"></iframe> </div> Why do you need it in a certain place, anyway? Quote Link to comment Share on other sites More sharing options...
smumpkins Posted April 17, 2008 Author Share Posted April 17, 2008 No, that's not what I'm shooting for. That would just put the iframe in a specific spot on my page. I want the page that's IN the iframe to load at a specific coordinate of the page within the iframe. The reason that I want to do this is because I'm lazy, and I'm trying to customize my homepage. Quote Link to comment Share on other sites More sharing options...
Zac Posted April 17, 2008 Share Posted April 17, 2008 So you want a page to load in your iFrame? To do that: <iframe name="test" src="example.com"> <a href="new-page.html" target="test"> \ Or do you want the page to load in a different part of the iFrame? To do that: <iframe src="new-page.html"> You would have to insert some styling into new-page.html, though. As Matt said. <style type="text/css"> html { left:20; top:30; } <style> Content Here. Quote Link to comment Share on other sites More sharing options...
smumpkins Posted April 18, 2008 Author Share Posted April 18, 2008 I'm trying to think of a better way to explain. There's the two pages: My page that has the iframe code, and then the page that's in the iframe that's not mine. I know how to move my iframe anywhere on MY page, but I want the page that's IN the iframe to load to spefic coordinates within the page. Let me see if I can show you what I mean. http://animangafanatics.110mb.com/ I made this site, personally. It's actually two different pages, with the index being the iframe linked to my content page. That being said, you notice that when you load it, the content loads at the top of the page within the iframe. I wanted to know if there was a way that it could load to a different coordinate, say, so it would have something else load to the top left hand corner versus the actual top of the page. ---------------------------- Top of the page ~~~~~~~~~~ Content ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ Bottom of page ---------------------------- That's pretty much what I have, right now. I want to see if I can get it to load something like this: ---------------------------- Content ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ Bottom of page ---------------------------- That way when the page loads, it focuses on the area that I want it to, since there's only one part of the site I actually use. I'm not trying to position the iframe, but trying to position the content within the iframe. Quote Link to comment Share on other sites More sharing options...
Superfly Posted April 18, 2008 Share Posted April 18, 2008 Just a word of wisdom. iframes are very outdated, and widely frowned upon in website creation. You might be better off just using css divs and stuff. CSS ftw. Edit: Also, iframes are do not work in all browsers, and some users might choose to just shut them off altogether, which then completely kills your website. Quote Link to comment Share on other sites More sharing options...
smumpkins Posted April 18, 2008 Author Share Posted April 18, 2008 @TJ: Well, between Veronique and I, it was the only way that we could get this to work the way that I was looking for. *shrugs* I'm very particular. If there's a way to do the same thing with CSS, I'd gladly do it - but I'm still learning HTML at this point. When I get home from work, I can insert all of the page code of the page that I plan to setup (only for my homepage use, anyways, so iframes don't matter XP), but I am just trying to figure out a way that the page loads at specific coordinates within the iframe. I know how to position an iframe with div tags, but that just moves the iframe around - not move the content within the iframe. Quote Link to comment Share on other sites More sharing options...
Strategos Posted April 18, 2008 Share Posted April 18, 2008 It's been a long time since I last coded with HTML, but can't you put the div tags inside the iFrames? Quote Link to comment Share on other sites More sharing options...
smumpkins Posted April 18, 2008 Author Share Posted April 18, 2008 Is that entirely possible? The webpage in the iframe is a completely different page all together. Essentially, the only way it could work would be to have the div tags on the page that I'm trying to put in the iframe, but that's impossible without owning the page. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.