PDA

View Full Version : Iframes in my Site


Chapo
04-21-2010, 04: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:
http://wapa.tv/huracanes2009.php

gentleone
04-21-2010, 05:10 AM
http://www.w3schools.com/tags/tag_iframe.asp

zebulonzed
04-21-2010, 05: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.
http://www.dynamicdrive.com/dynamicindex17/iframescroll.htm#

gentleone
04-21-2010, 01: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.

Chapo
04-22-2010, 04: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.

zebulonzed
04-22-2010, 04: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.

Chapo
04-22-2010, 05: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

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

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

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

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

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

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

Chapo
04-25-2010, 07: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...

Rob_Che
04-25-2010, 07: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 ;
etc
}


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

Chapo
04-25-2010, 07: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 ?

Rob_Che
04-25-2010, 07: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 . . .

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

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

Are you editing your css stylesheet by hand?

Chapo
04-25-2010, 10: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 ?

Rob_Che
04-25-2010, 10: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 :)

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