Closed Thread
How To Center Your Website
Old 01-30-2008, 04:26 PM How To Center Your Website
LadynRed's Avatar
Super Moderator

Posts: 8,821
Location: Tennessee
Trades: 0
With CSS solutions of course. This question comes up constantly, so here are links to several resources specific to this issue:

HORIZONTAL CENTERING
http://www.maxdesign.com.au/presentation/center/
http://bluerobot.com/web/css/center1.html
http://www.simplebits.com/notebook/2...centering.html
http://www.andybudd.com/archives/200...ntering_a_div/
http://css-discuss.incutio.com/?page...ngBlockElement
http://allmyfaqs.net/faq.pl?Center_with_CSS
If you have new resources, PM me and I'll add them, this thread is now locked
VERTICAL CENTERING
http://www.hicksdesign.co.uk/journal...ering-with-css
http://www.jakpsatweb.cz/css/css-ver...-solution.html
http://tutorials.alsacreations.com/centrer/
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club

Last edited by LadynRed; 09-13-2008 at 12:48 PM..
LadynRed is offline
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 02-29-2008, 09:36 AM Re: How To Center Your Website
dougadam's Avatar
The Watkins Man

Posts: 349
Name: Douglas Adams
Location: Traverse City, Michigan
Trades: 0
I have often been in need of this information.
Thanks
dougadam is offline
View Public Profile Visit dougadam's homepage!
 
Old 02-29-2008, 10:04 AM Re: How To Center Your Website
Webmaster Talker

Posts: 581
Name: Barry O' Brien
Location: Ireland
Trades: 0
or simply use this

}
#container {
margin:0 auto;
width:860px;
bottom:0;
}
audiomad is offline
View Public Profile Visit audiomad's homepage!
 
Old 02-29-2008, 03:32 PM Re: How To Center Your Website
LadynRed's Avatar
Super Moderator

Posts: 8,821
Location: Tennessee
Trades: 0
It's not ALWAYS that simple.. and as you can see if you read the articles, there are many different solutions.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
View Public Profile
 
Old 03-26-2008, 10:32 AM Re: How To Center Your Website
pothi's Avatar
Novice Talker

Posts: 5
Name: Pothi Kalimuthu
Location: India
Trades: 0
Hi,

I'm new to webdesign. I've done horizontal centering for a small website. I was scratching my head for vertical in combination with horizontal centering. Your links have been useful to me.

Thanks a lot.
pothi is offline
View Public Profile
 
Old 03-28-2008, 01:01 PM Re: How To Center Your Website
Ultra Talker

Posts: 308
Trades: 0
Thank you.

Some of those were quite hard to follow but I found this one the easiest for centering a DIV in the middle of a page - horizontal and vertical.
Joe3000 is offline
View Public Profile
 
Old 04-10-2008, 04:28 PM Re: How To Center Your Website
Average Talker

Posts: 19
Trades: 0
Quote:
Originally Posted by audiomad View Post
or simply use this

}
#container {
margin:0 auto;
width:860px;
bottom:0;
}
Quote:
Originally Posted by LadynRed View Post
It's not ALWAYS that simple.. and as you can see if you read the articles, there are many different solutions.
Actually it is simple if you use that method in conbination with the right DOCTYPE. For instance, the following won't work:
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
But this will:
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
And of course, the stylesheet:
HTML Code:
#container {
 margin: 0 auto;
 width: 960px;
 }
__________________
WebdesignGold.com
Web Design Resources
WebdesignGold is offline
View Public Profile Visit WebdesignGold's homepage!
 
Old 04-10-2008, 07:16 PM Re: How To Center Your Website
Gilligan's Avatar
Dead Like Me

Posts: 1,632
Name: Stefan
Location: London, UK
Trades: 0
But still, she said

"its not ALWAYS"

meaning most of the time it will work.
__________________
DoThatDesign.com - Professional Website Design - FREE Quotes!
Gilligan is offline
View Public Profile
 
Old 04-11-2008, 11:34 AM Re: How To Center Your Website
LadynRed's Avatar
Super Moderator

Posts: 8,821
Location: Tennessee
Trades: 0
IMO, if you're using a Transitional doctype with LOOSE, you're just being a lazy coder and not doing your audience any favors.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
View Public Profile
 
Old 05-08-2008, 12:33 PM Re: How To Center Your Website
Novice Talker

Posts: 4
Name: John Rosa
Trades: 0
thanks again
RosaJ82 is offline
View Public Profile
 
Old 05-09-2008, 09:17 AM Re: How To Center Your Website
sfpavel's Avatar
Experienced Talker

Posts: 35
Name: Razvan Pavel
Location: Bucharest, Romania
Trades: 0
thnx a lot. no more googleing on how to center bloody divs
sfpavel is offline
View Public Profile
 
Old 07-25-2008, 05:01 AM Re: How To Center Your Website
abhi's Avatar
Super Talker

Posts: 100
Name: abhishek
Location: mauritius
Trades: 0
very useful things. I have already make used of one of the guide.
__________________
www.islandinfo.mu: Visit Mauritius Island for your holidays!
abhi is offline
View Public Profile Visit abhi's homepage!
 
Old 07-29-2008, 09:59 AM Re: How To Center Your Website
Skilled Talker

Posts: 62
Name: murali
Trades: 0
its useful to me .. thanks a lot ...do share more of this kind.. useful for webdesigners like me
umurali2000 is offline
View Public Profile
 
Old 08-24-2008, 04:25 PM Re: How To Center Your Website
Novice Talker

Posts: 10
Name: John Meen
Trades: 0
niceee thanks!
dev114 is offline
View Public Profile
 
Old 08-25-2008, 12:12 PM Re: How To Center Your Website
Experienced Talker

Posts: 33
Name: Toby Osbourn
Trades: 0
Very handy, cheers.
tosbourn is offline
View Public Profile
 
Old 08-26-2008, 04:26 AM Re: How To Center Your Website
thurrz's Avatar
Skilled Talker

Posts: 92
Trades: 0
Thanks
Before my site used to a problems regarding centering of divs
__________________
dog proof fencing | dog strollers | dog supply
thurrz is offline
View Public Profile
 
Old 08-30-2008, 07:17 AM Re: How To Center Your Website
Super Talker

Posts: 102
Trades: 0
Hello,
You can use this code
#content {
width: 700px ;
margin-left: auto ;
margin-right: auto ;
}
__________________
Audience Response Systems

John_audson is offline
View Public Profile
 
Old 09-05-2008, 03:14 AM Re: How To Center Your Website
Average Talker

Posts: 21
Trades: 0
Quote:
Quote:
Originally Posted by audiomad
or simply use this

}
#container {
margin:0 auto;
width:860px;
bottom:0;
}
Quote:
Originally Posted by LadynRed
It's not ALWAYS that simple.. and as you can see if you read the articles, there are many different solutions.

Isn't that like all you neeed?... It's the only one I know, and has never failed me. XP
zerodash is offline
View Public Profile Visit zerodash's homepage!
 
Old 09-05-2008, 10:11 AM Re: How To Center Your Website
LadynRed's Avatar
Super Moderator

Posts: 8,821
Location: Tennessee
Trades: 0
As I stated, there are many solutions depending on what you're trying to accomplish and how your layout is done. Most of the time the margin:0 auto with a width is all that's needed to horizontally center a layout. Some people want to center vertically too, and others who use absolute positioning for everything may not be able to use this simple solution. So.. it depends!
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
View Public Profile
 
Old 09-06-2008, 05:27 PM Re: How To Center Your Website
dietcorenet's Avatar
Novice Talker

Posts: 8
Name: Terry
Location: San Diego
Trades: 0
Wow!
Nothing like a little bit of information to make the light bulb come on!

Thanks
dietcorenet is offline
View Public Profile
 
Closed Thread     « Reply to How To Center Your Website
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.20254 seconds with 13 queries