Centralising my site

This is a discussion on "Centralising my site" within the Web Page Design section. This forum, and the thread "Centralising my site are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Nov 1st, 2007, 11:06
Reputable Member
Join Date: Oct 2007
Location: UK
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
Centralising my site

Hey, currently working on a site, heres a shortened version of my code....

<div id="container">
<div id="banner"></div>
<div id="middle"></div>
<div id="footer"></div>
</div>

The container is 700 x 700 pixels, how do i centralise the whole thing so it alway appears in the middle of the browser?

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 1st, 2007, 11:50
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

You need margin: 0 auto; in your container div css
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Nov 1st, 2007, 11:52
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

You would want to use this:
HTML: Select all
<div id="middle" align="center"></div>
That is the simplest way to do it. If you mean something else, I can still help...

Cheers,
SWagner
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 1st, 2007, 11:59
Reputable Member
Join Date: Oct 2007
Location: UK
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

AdRock, im already using margin: 0 auto; but it isnt working in ie, its fine in mozilla. In IE the containers about 5 - 10 pixels from the left
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 1st, 2007, 12:05
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Then post a link so we can see the whole thing!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 1st, 2007, 12:45
Reputable Member
Join Date: Oct 2007
Location: UK
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Calm down Karinne. It isnt online yet.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Nov 1st, 2007, 12:51
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Calm down? Who's freaking out?

All I'm telling you is that if you want help, put your site online. There's plenty of free hosting (see freewebs.com).

If the code we gave you, which is right, isn't working, then there's something else causing a problem so we need to see the whole thing.

The easiest way, and fastest, to get help, proper help, is to provide a link.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Nov 1st, 2007, 14:12
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Centralising my site

Quote:
Originally Posted by swagner View Post
You would want to use this:
HTML: Select all
<div id="middle" align="center"></div>
That is the simplest way to do it. If you mean something else, I can still help...

Cheers,
SWagner
That's depricated, use margin: 0 auto; instead.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Nov 1st, 2007, 23:57
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Alex, he already said it wasn't working with margin:0 auto; that's why I suggested the div align value... But any other (or better) solutions would still be good. Correct me if I'm wrong!
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)

Last edited by Stuart; Nov 2nd, 2007 at 00:32.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Nov 2nd, 2007, 00:14
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Centralising my site

This should definitely work.
Code: Select all
#container {
width: 800px;
margin: 0 auto;
}
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Nov 2nd, 2007, 00:18
Most Reputable Member
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Quote:
Originally Posted by swagner View Post
Alex, he already said it wasn't working with margin:0 auto; that's why I suggested the div align value... But any other (or better) solutions would still be good.
Excepting ignorance, there's no justification for suggesting deprecated methods, when their correct counterparts are simple. Let's teach people good methods, and not outdated crud from the 90's.

If "margin: 0 auto" is failing, it's probably because he's looking at the page with the IE5 layout engine. This engine does not support auto margins.

This will happen in IE6, when an incorrect doctype is declared. IE6 will then activate doctype switching, and use the old IE5 layout engine.

You can see why it helps to have a link!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Nov 2nd, 2007, 00:31
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

OK, I give up. I guess I've been living in the past... Sorry for being deprecated! I did not want to give bad advice, I just did not know that it was deprecated (no one tells me these things!).
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)

Last edited by Stuart; Nov 2nd, 2007 at 00:41.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Nov 2nd, 2007, 05:09
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Centralising my site

Quote:
Originally Posted by MikeHopley View Post
Excepting ignorance, there's no justification for suggesting deprecated methods, when their correct counterparts are simple. Let's teach people good methods, and not outdated crud from the 90's.

If "margin: 0 auto" is failing, it's probably because he's looking at the page with the IE5 layout engine. This engine does not support auto margins.

This will happen in IE6, when an incorrect doctype is declared. IE6 will then activate doctype switching, and use the old IE5 layout engine.

You can see why it helps to have a link!
Wow Mike, what a "technical sollution" there!
Now.. everytime I see this kind of problem, I'll copy and paste your technical explaination there for them to read! hehehe.. seriously..!

I never knew that, another knowledge from you, I guess
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Nov 3rd, 2007, 13:12
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Quote:
Originally Posted by swagner View Post
OK, I give up. I guess I've been living in the past... Sorry for being deprecated! I did not want to give bad advice, I just did not know that it was deprecated (no one tells me these things!).
Hey swagner,

to see what elements and attributes are deprecated, have a look the W3C site

Elements
Attributes

There's a Depr. column in both those tables. If there's a D, then it's deprecated

hth
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Nov 3rd, 2007, 14:05
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Have you sorted out the problem yet? If not can you post the code so we can see....you may have missed something which somebody else may pick up?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Nov 3rd, 2007, 17:32
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Thanks Karinne! Most of those I knew. I just never realized the align elements/attributes were deprecated.
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old Nov 5th, 2007, 16:12
Most Reputable Member
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Centralising my site

Quote:
Originally Posted by swagner View Post
I just never realized the align elements/attributes were deprecated.
You'll find out such things pretty quickly if you validate against a Strict doctype.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
I bring this site up again because, I have no idea how to make this site pull in. TheSealPortalTeam Free Web Site Critique 4 Jun 10th, 2008 12:46
Uploaded site different from local site alowe Web Page Design 20 Mar 28th, 2008 02:20
[SOLVED] Centralising a sub-wrap Madball Web Page Design 10 Nov 6th, 2007 14:43
off-site linking to a particular page in a site made with frames. NEED HELP vandiermen Web Page Design 1 Aug 6th, 2006 13:30
[req] Free basic web templates site + button design site slorryy Web Page Design 3 Feb 17th, 2006 17:05


All times are GMT. The time now is 18:05.