Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mike Teezie

macrumors 68020
Original poster
Nov 20, 2002
2,205
1
Hey guys. A friend of mine's Dad asked me to build him a site for his local business. Here is what I have so far:

http://dopertees.com/rcbonline.htm

Please excuse the text and green blocks, they are just place holders.

Anyways, I like the way things are looking, I just want the whole "thing" to be in the center.

Is the reason it won't center up is because of the "position: absolute" values attributed? Is it possible to center my site?

I guess I could use a table to get it centered, but I'm trying to learn more about CSS. If I need to post anything else, I'd be more than happy to.

Any help would be greatly appreciated. Thanks in advance.

Here is my CSS:

Code:
body {
	font-family: verdana, arial, helvetica, sans-serif;
	font-size: 12px;
	background: url([url]http://dopertees.com/Images/bodyback.gif[/url]) ;
	padding: 0;
}

#top {
	width: 754px;
	height: 167px;
	background:  url([url]http://dopertees.com/Images/topback4.gif[/url]);
	}

#container {
	width: 754px;
	background: url([url]http://dopertees.com/Images/containerback2.gif[/url]);
	position: absolute;
		top: 167px;
	text-align: center;
}

.link {
	text-align: center;
	padding: 115px
}

.container {
	font-family: verdana, arial, helvetica, sans-serif;
	font-size: 12px;
}
 
Code:
#container {
  margin-left: auto;
  margin-right: auto;
}

That should take care of it, also I would recommend putting the header within the container. You really don't need to use positioning for anything, I've found that simply using margins tends to work much better.

edit: one more thing... get the tables outta there! :eek:
 
Ah, thanks so much davecuse - that did the trick.

Of course, I woke up this morning, hated the look, and redid everything. But your css help made the whole re-do process much, much smoother.

Thanks!
 
it sure doesn't brap.

I just had a friend check it, and it's back to the drawing board.

I hate Internet Explorer.
 
Yeah, to make the margin-left/right: auto thing work in IE you have to give a text-align: center to the parent div or to the body element. That is how I center most of the things I center.

scem0
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.