Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-04-18 18:53:00
- daikw
- Member
- Registered: 2007-10-06
- Posts: 39
CSS: centering whilst controlling column width
Hi there,
I am having some problems aligning the body content and navigation elements of my textpattern site.
I would like all content on the page to be center aligned, like this
However, I need to be able to control the column width of content so that I can limit the image thumbnails, to say, 9 thumbnails per line.
However, when I create a div for a block of content and style it using width: 960px;
it suddenly loses its centered position. like this
Could someone tell me how I can keep all the elements centered, but still be able to control their width?
Last edited by daikw (2008-04-18 18:53:19)
Offline
#2 2008-04-18 19:05:50
- bancroft
- Member
- Registered: 2005-09-30
- Posts: 39
Re: CSS: centering whilst controlling column width
On #bodycopy change margin: 30px 0px; to margin: 30px auto; that will center the div.
Offline
#3 2008-04-18 22:01:24
- daikw
- Member
- Registered: 2007-10-06
- Posts: 39
Re: CSS: centering whilst controlling column width
Thanks a million, Bancroft, I will remember that one now! :D
Offline
#4 2008-04-20 23:57:35
- daikw
- Member
- Registered: 2007-10-06
- Posts: 39
Re: CSS: centering whilst controlling column width
Okay, that works for Firefox, but when I load a page in a windows version of IE, the content still moves to the left side of the page.
Could someone suggest a fix or a hack for IE?
Thanks
Offline
Re: CSS: centering whilst controlling column width
Offline
Re: CSS: centering whilst controlling column width
Also, ya should little validate your page. Yes, it does almost pass the validators, but it’s just coz it can not be parsed as there is no document type nor html tags used correctly, and therefor the code is untraceable.
So, my todo would be in this case:
- Add doctype
- Add html starting tags
- Remove the XHTML from the
<head>
– there shouldn’t be any non-head beloning data. - Then validate it
As it’s current state, it’s working, in some browsers, some not at all, coz there is some really big pitfalls. But it’s good start :)
Offline
#7 2008-04-21 02:04:23
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: CSS: centering whilst controlling column width
Older IEs will sometimes expand your overall container as they see fit. Adding a property like overflow-x: hidden;
will in most cases bring back things into alignment.
Offline
Re: CSS: centering whilst controlling column width
Use the version of bancroft and be sure browsers render your site in standard compliance mode. So no hack for an IE is needed.
Digital nomad, sailing the world on a sailboat: 32fthome.com
Offline