This is a discussion on "How to center a page without use of a table" within the Web Page Design section. This forum, and the thread "How to center a page without use of a table are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
How to center a page without use of a table
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
How to center a page without use of a table
hi, I'm sort of an off-and-on designer who does small pages mainly for friends and family, but I'm sort of learning CSS. I've got something started at
http://pdk.lolmaha.com/design but I can't for the life of me figure out how to center it without the use of a table OR a container div as I've done in this. if someone could tell me what i'm doing, it would be greatly appreciated |
|
|
|
#2
|
|||
|
|||
|
Re: How to center a page without use of a table
Links not working so can't see your code!
|
|
#3
|
|||
|
|||
|
Re: How to center a page without use of a table
Your combination of css styling code and the use of a container div is just fine.
Get into the habit of placing your css in a seperate file and <link... it into your pages. |
|
#4
|
||||
|
||||
|
Re: How to center a page without use of a table
Something has to be fixed width, but you can add margin: 0 auto; to an element.
|
|
#5
|
|||
|
|||
|
Re: How to center a page without use of a table
Last edited by karinne; Jan 22nd, 2007 at 13:32. |
|
#6
|
|||
|
|||
|
Re: How to center a page without use of a table
also text-align:center; the body and text-align:left; your container. IE7 doesn't seem to like margin:0 auto;
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#7
|
|||
|
|||
|
Re: How to center a page without use of a table
Quote:
|
|
#8
|
||||
|
||||
|
Re: How to center a page without use of a table
I heard that too, perhaps it was on one of the beta versions?
|
|
#9
|
|||
|
|||
|
Re: How to center a page without use of a table
quick reply to you dude
use margin-left:auto; and margin-right:auto to centre your divs |
|
#10
|
|||
|
|||
|
Re: How to center a page without use of a table
margin:0 auto is less code and works the same
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#11
|
|||
|
|||
|
Re: How to center a page without use of a table
I test in IE 7 under Parallels and on IE 7 at work both XP Pro. Neither one supports it for me, perhaps I just need to update it. Will run sw update at home and see.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#12
|
||||
|
||||
|
Re: How to center a page without use of a table
Yep, that's good to know!
|
|
#13
|
|||
|
|||
|
Re: How to center a page without use of a table
The code I posted in my first reply, you'll notice I don't have the text-align: center in the body { }. Only margin: 0 auto; and a width in the #wrap.
You can test it here. |
|
#14
|
|||
|
|||
|
Re: How to center a page without use of a table
Yes centering only works with a width value specified. Good point =P.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#15
|
|||
|
|||
|
Re: How to center a page without use of a table
Okay, so I've solved that problem. How do I make column1 and column2 the same length no matter what?
|
|
#16
|
||||
|
||||
|
Re: How to center a page without use of a table
Unforunately you can't.
|
|
#17
|
|||
|
|||
|
Re: How to center a page without use of a table
A bit of stuff I noticed:
Change this code:
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#18
|
|||
|
|||
|
Re: How to center a page without use of a table
Well you can in ways..
1. Simulate the columns by using a background image repeating on the y axis of your container so a border whatever appears the entire height of the containing div or even on the body. Called "Faux Columns". 2. Specify them both the same height and use the over flow auto property 3. Give both the same amount of content 4. (This one is not recommended) use javascript to control them.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|