View Full Version : Iframes in my Site

04-21-2010, 05:52 AM
Ok, Im about to create a weather-site, but the live images, info and global weather comes from another source that is a paid service, they told me that i have to build an iframe in my site. Im new with thing of iframes and didn't find much info on the web or any of my books... does somebody could help me out in how to do this, or link me a tutorial ?

here is an example of how site with their service:

04-21-2010, 06:10 AM

04-21-2010, 06:28 AM
I love iframes (dunno why so many sneer at their use). They're so simple its almost ridiculous that it works. You can put 'em anywhere, is the nice thing, they don't seem to be tempramental or tricky. All you need fundamentally is...

<-- to prevent a reaction here in the post. don't need this

<iframe src="the url or html page you want to appear" width="pixel or percent value" height="pixel or percent value" frameborder="0 or number value" scrolling="yes/no or auto" align="whatever" name="whatever"></iframe>


there's a nifty and quite modifiable javascript that lets you create scroll action (instead of having ugly scroll bars) by a mouse over on either up/down text links or images, with speed control and more, but this only works for personal content, not an iframe calling to another site.

04-21-2010, 02:22 PM
I love iframes (dunno why so many sneer at their use).

To load third party content ads, banners etc. ina an iframe is ok, but to load HTML snippets from your own domain into it is bad practice due to SEO, bookmarking and accessibility reasons to name a few.

04-22-2010, 05:26 AM
OK... the code works great..... but the problem now is that i created the new html and inside i added a div to be to my iframe, but how i could use the code with the div, so it will be my iframe ? The div is in the right place where i want my iframe to be.

04-22-2010, 05:40 AM
You should be able to have your iframe tag(s) right between your start and close div tag(s), unless I'm misunderstanding you.

04-22-2010, 06:09 AM
Basically i just created a div inside my html, so that div will be my iframe. Its in a div because i could place it anywhere i want. About the tags makes sense, could you paste an example of the code to see much better the tags well placed like it should be ? Thanx

04-23-2010, 09:49 PM
I hope I understand what you're needing ...

<--- (this not needed, of course)

<div align="center">
<iframe src="http://www.google.com" width="500" height="425"
frameborder="0" scrolling="auto" align="center" name="example"> </iframe>

---> (this not needed, of course)

04-25-2010, 04:42 AM
Thanx.... that was a huge help you gave me... !!!!

04-25-2010, 05:03 PM
Just style the iFrame with css - no need for a div is there?

04-25-2010, 08:16 PM
Need for a DIV ? Well, is there another way to put an iframe to my html exactly in the place i want ? I thought this was the only way...

04-25-2010, 08:43 PM
I've never used it personally but I see no reason why you can't just give it a css class as you would a div and style away... :)

<iframe src="http://site.com" class="myiFrame"></iframe>

.myiFrame {
width: 500px ;
height: 500px;
float: right ;

Don't shoot me if I'm wrong though :wink:

04-25-2010, 08:49 PM
Ok... so with the class will be enough to put the iframe anyplace i want in the html ? Because i see in your code that the iframe is floating to the right, but its not specifically in a place.

Lets say i have an html with a top banner, i want the iframe just below that and centered, can i do it with the class ?

04-25-2010, 08:56 PM
Use exactly the same css styling with the iFrame as you would have used with your div.

It's difficult without seeing it in context but say...

<div id="header"">Nav and stuff....</div>
<iframe class="myIframe" src="http://site.com></iframe>

.myIframe {
width: 500px ;
height: 500px ;
margin: 10px auto ; <-- 10px top and bottom and auto fills equally on each side

Try that . . .

04-25-2010, 09:21 PM
Thanx..I'll give it a try...!!!!

04-25-2010, 10:35 PM
The .myIframe section goes in your stylesheet yeah?

Are you editing your css stylesheet by hand?

04-25-2010, 11:22 PM
I could do it either way.... hand or at dreamweaver
do you recomend something ?
Does it necesary .myIframe has to go external stylesheet ?

04-25-2010, 11:28 PM
Sorry, wherever your styles are - I just didn't want you to post it in the page HTML after the iFrame :) - Just making myself clear... it's late :)

04-26-2010, 02:09 AM
hehe .... OK.!!