Are you able to explain this? I'd be grateful

This is a discussion on "Are you able to explain this? I'd be grateful" within the Web Page Design section. This forum, and the thread "Are you able to explain this? I'd be grateful are both part of the Design Your Website category.



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

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 10th, 2007, 23:28
Junior Member
Join Date: May 2007
Location: London
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Are you able to explain this? I'd be grateful

I'm only just starting to learn this stuff - What I really want to know is - what aligns the the main container in the centre of the browser window, like on this page?

http://www.eostreorganics.org/

That's made from a template, now I'm trying to write my own template from scratch, but I can't work out how the centre alignment's done..

http://www.newoptical.net/newoptical.html

I presume it's CSS anyway. If anyone would be kind enough to explain that too me I'd be most grateful.

Thanks, Adam
Reply With Quote

  #2 (permalink)  
Old May 10th, 2007, 23:36
SuperMember

SuperMember
Join Date: Apr 2007
Location: Ireland
Age: 15
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Pádraig
Re: Are you able to explain this? I'd be grateful

Code: Select all
/* main container */
#main{width: 780px;}
Code: Select all
/* margin lefts / margin rights - to centre content */
#main, #links, #footer, #logo, #menu, #content
{ margin-left: auto; 
  margin-right: auto;
}
This may be wrong but its what is in their stylesheet

http://www.eostreorganics.org/style/style.css
Reply With Quote
  #3 (permalink)  
Old May 10th, 2007, 23:51
Junior Member
Join Date: May 2007
Location: London
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

Thanks Padraig, that was my original thought, but the second link in my first post has the same exact section of css in it too, yet that's still stuck on the left..

Last edited by newoptical; May 11th, 2007 at 00:05.
Reply With Quote
  #4 (permalink)  
Old May 11th, 2007, 00:41
Junior Member
Join Date: May 2007
Location: London
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

Quote:
Originally Posted by Pádraig View Post
Code: Select all
/* main container */
#main{width: 780px;}
Code: Select all
/* margin lefts / margin rights - to centre content */
#main, #links, #footer, #logo, #menu, #content
{ margin-left: auto; 
  margin-right: auto;
}
This may be wrong but its what is in their stylesheet

http://www.eostreorganics.org/style/style.css
Aha! the problem was simply that the newoptical page had an extra comma at the end ( #main, #links, #footer, #logo, #menu, #content, ) instead of ( #main, #links, #footer, #logo, #menu, #content ). So you were quite right. My sloppy coding at fault. Thanks again, deleting the extra comma solved the problem
Reply With Quote
  #5 (permalink)  
Old May 11th, 2007, 04:06
Reputable Member
Join Date: Dec 2005
Location: Texas
Age: 19
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to daygon Send a message via MSN to daygon Send a message via Yahoo to daygon
Re: Are you able to explain this? I'd be grateful

you also want to do this for older IE Browsers because some of them dont recognize margins.
Code: Select all
body{
text-align: center;
}
Reply With Quote
  #6 (permalink)  
Old May 11th, 2007, 10:54
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

Proper coding to center the div is
Code: Select all
#main, #links, #footer, #logo, #menu, #content {
margin: 0 auto;
}
Reply With Quote
  #7 (permalink)  
Old May 11th, 2007, 11:32
Junior Member
Join Date: May 2007
Location: London
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

Thanks guys, good stuff - I've taken both your recommendations on board. Thus far..

http://www.newoptical.net/
Reply With Quote
  #8 (permalink)  
Old May 11th, 2007, 13:20
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

Actually, the right way of doing it is simply (taking your code here):

Code: Select all
/* main container */
#main {
    margin: 0 auto;
    width: 800px;
}
Since your #main wraps all your div, it will center everything. You could also do this with the body element

How to center your site horizontally
body can be used to style too!

Last edited by karinne; May 11th, 2007 at 14:27.
Reply With Quote
  #9 (permalink)  
Old May 11th, 2007, 14:21
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,737
Blog Entries: 1
Thanks: 0
Thanked 16 Times in 16 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Are you able to explain this? I'd be grateful

Don't forget text-align:center; on the body and text-align:left on your container for IE 5.x. Sucks but necessary.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #10 (permalink)  
Old May 11th, 2007, 14:54
Junior Member
Join Date: May 2007
Location: London
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

Quote:
Originally Posted by moojoo View Post
Don't forget text-align:center; on the body and text-align:left on your container for IE 5.x. Sucks but necessary.
Thanks moojoo, like this then?

http://www.newoptical.net/

http://www.newoptical.net/style/newoptical.css

I did what Karinne suggested to, and removed all the other previous centre align code.

Last edited by newoptical; May 11th, 2007 at 14:58.
Reply With Quote
  #11 (permalink)  
Old May 11th, 2007, 14:57
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,737
Blog Entries: 1
Thanks: 0
Thanked 16 Times in 16 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Are you able to explain this? I'd be grateful

Yup, just because IE 5.x doesn't support margin:0 auto;
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #12 (permalink)  
Old May 11th, 2007, 14:58
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

Yeppers!
Reply With Quote
  #13 (permalink)  
Old May 11th, 2007, 15:05
Junior Member
Join Date: May 2007
Location: London
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

Nice! Thanks again, what a great forum
Reply With Quote
  #14 (permalink)  
Old May 11th, 2007, 15:30
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Are you able to explain this? I'd be grateful

:rofl: You're saying that 'cause you just got here!
Reply With Quote
  #15 (permalink)  
Old May 11th, 2007, 21:13
Reputable Member
Join Date: Dec 2005
Location: Texas
Age: 19
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to daygon Send a message via MSN to daygon Send a message via Yahoo to daygon
Re: Are you able to explain this? I'd be grateful

karinne let him tell how much he loves us and revears us like gods (of the internet).
Reply With Quote
  #16 (permalink)  
Old May 13th, 2007, 19:18
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,737
Blog Entries: 1
Thanks: 0
Thanked 16 Times in 16 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Are you able to explain this? I'd be grateful

Long live tha intarWeb Screenies!
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #17 (permalink)  
Old May 16th, 2007, 19:22
Reputable Member
Join Date: Dec 2005
Location: Texas
Age: 19
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to daygon Send a message via MSN to daygon Send a message via Yahoo to daygon
Re: Are you able to explain this? I'd be grateful

this guy...
Reply With Quote
Reply

Tags
alignment, centre alignment, css, help

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
can someone explain this briefly to me perform300 Website Planning 3 Sep 2nd, 2007 02:10
Can someone explain this to me? brockomundo JavaScript Forum 2 Jun 30th, 2007 01:50
Could someone explain the advantages of having validated HTML coding? christopher Web Page Design 11 Aug 3rd, 2006 12:59
grateful for any help and advice on web hosting. bigpato Hosting & Domains 5 Jun 27th, 2006 10:17


All times are GMT. The time now is 19:12.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43