...

View Full Version : centering iframes?



JpDm
01-14-2004, 01:32 AM
i know... it sounds like a simple question...

but i dunno how to do it...

i have a background picture... with boxes and stuff where the iframes are supposed to go, when u maximize or resize the window... the background picture would stay centered no matter how big the window is... but the iframes stay in the same spot.. and they dont follow the bg picture :(

can someone help me plz?

JAVAEOC
01-14-2004, 01:44 AM
do you have a link to the site?

JpDm
01-14-2004, 02:03 AM
its on my computer

but ill post what i have so far to show u

Antoniohawk
01-14-2004, 02:12 AM
Im not really sure that this is a javascript question, a moderator will move it to the right forum for you. Im pretty sure that you could just center the iframe, but id have to see it myself.

JpDm
01-14-2004, 02:15 AM
http://www.geocities.com/sdalphabeta/index2.htm

kk... what I see... is the iframe fitting perfectly into the window ( i know the iframes are broken links now, just getting started xD)

but when i maximize the window... the bg image moves to the center... but the iframes stay in the same spot :(

how would u center that?

Lomandriel
01-14-2004, 02:37 AM
You're in luck man, I'm one of the newest programmers here as well as this is my first day here! I've only learnt the basic html, and recently after (who knows how long :rolleyes: I've returned to learning web design after 1 or 2 years since my first pitiful attempt at a website). Anyway I began asking a friend who has a great webseite, along with another(and they're both girls, so it definitely proves that everyone is equal, and I do find alot of girls are into web design now adays, quite interesting if you ask me.) for help.

Sorry for telling you my life story, anyway, the first thing one of them went into was iframes, haha and using my common sense I asked how you'd reposition the iframe on the page. Anyway, you're in luck here is the source code for it and btw iframes isn't java script related, unless you want to use it to enhance/modify the iframe:

<HTML>
<HEAD></HEAD>

<BODY>
<p>&nbsp;</p>
<div style="position:absolute;top:100;left:150">
<iframe width="200" height="300" src="page.html">
</iframe></div></p></BODY></HTML>


Ok replace the src with the page you want to display, and then youfcan modify the width/height of the iframe. The <div styleE= " position: absolute, basically means that you are saying to put it anywhere on the screen. Play around with the values of the top and left until you get it positioned into the background boxes allotted for it. And then that code also gives you the nifty feature of resizing just incase you estimated the box's measurements incorrectly.

Good luck, and, I also got taught how to change the colour of the iframe scroll bar if your interested.....

JpDm
01-14-2004, 02:46 AM
thx... but i already know how to make iframes... :x

i just wanted to know if there was a way to make them move along with your site...and not just stay in the same spot...


or if that doesnt work... how would u make div layers for it


ps. sorry i posted in wrong forum

Antoniohawk
01-14-2004, 03:15 AM
Ok im not a css guru or anything, but i think i can help you sort out your site a bit and what i cant do, others can. First of all, I'm sorry to have to break it to you that tables are not the way to design the layout of your site. Tables are for arranging data, such as in a science experiment you may put your data in a table. The way to go with webdesign is css. As I look at your source I can see that you already know css so now all you need to do is use a lil more of it. The way to go, is to arrange a <div> and put your content inside.

There are also some things in your code that need to be coded in css rather than inline and some things that just plain aren't supported by standards anymore. As a starter, all of the things inside the body tag need to be removed and placed in a css declaration like so:


body {
background: #1B1B1B;
margin-top: 0;
margin-left: 0;
}

a:link {color: #FFFFFF;}
a:visited {color: #FFFFFF;}
a:hover {color: whatever color you want;}
a:active {color: ##999999;}


I also suggest replacing the font tag with a <p> and some css. I've gotta go now, but I'll be checking back and adding some more stuff you could do to make your website reach its full capabilities.

glenngv
01-14-2004, 03:48 AM
You can put the iframe in between <center></center> tags but that tag is already deprecated. You should use CSS.

<div style="text-align:center">
<iframe src="page.htm"></iframe>
</div>

Lomandriel
01-14-2004, 04:26 AM
All I know is if you want to align the background the white templates with the iframe:

<HTML>
<HEAD></HEAD>

<BODY>
<p> </p>
<div style="position:absolute;top:100;left:150">
<iframe width="200" height="300" src="page.html">
</iframe></div></p></BODY></HTML>

And then just change the values to align. About making the iframes actually move with the page as you scroll down, well I have no clue< i don't know any css, java, and hardly any html, but I must say I've never seen one site with a feature like that. Whether it's possible or not, I'm not sure, btu then again I'm sure everything is in web design.:thumbsup:

ArcticFox
01-14-2004, 05:13 AM
I know no one wants to hear this (and I don't care), but I just use regular frames to position things the way I want.

My entire site is a frames/iframes mix...

http://arctic.ithium.net/

*Don't listen to these people who say you can't use tables, center tags, this, that, blah, blah... It's your site - do as you wish with it!

-A.F.

Lomandriel
01-14-2004, 06:38 AM
I agree arctic, not to go off topic but anyone can create a masterpiece website using anything. Ok maybe if you used just html the normal <b>, <H1> etc it wouldn't look as nice, but I think there's nothing wrong with tables. Alot of people I know use tables for teir website the different sections: the blog, latest news etc, and have an iframe in the middle to load any pages you click links on.

However the code I did post will let you position the iframe basically anywhere....it's offtopic but I also have css code to change the colour of the scroll bar etc, as well as bits to put in to neaten up the page using css(my html page looked very different with the css code!).:thumbsup:

JAVAEOC
01-14-2004, 12:29 PM
artc? your site looks good but the bad thing is i cant scroll down.

and the whole page does not fit in my resolution :(

Antoniohawk
01-14-2004, 07:40 PM
For that very reason, css is the answer. With css you can make your site liquid, or viewable across different resolutions. Im not gonna say that you shouldn't use tables, im just saying that if you want to save yourself alot of frustration get rid of them.

ArcticFox
05-28-2005, 01:31 AM
artc? your site looks good but the bad thing is i cant scroll down.

and the whole page does not fit in my resolution :(

What is your resolution and browser?
This site is designed to fit inside 800x600+.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum