//
you're reading...
web design

Centering a fixed position layout CSS

You browse for templates for your web site, you finally found one and you want to create something of the sort.

My first problem is getting things to look right.

Ever wonder how fixed position containers stay at the center of a page?

hello, margin.

#container
{
 //the fixed size width of your page.
        width: 900px;
	height: auto;
	background-color: #fff;
	border:0;
	overflow:auto;
	padding-bottom: 100px;
	font-size: 10pt;
        //these center the divs nicely on the page.
	margin-left: auto; margin-right: auto;
}

Make sure your main #container that houses your entire site has a left and right  margin of :auto .

So the next time you want a Div centered to the page. You know what to do. :D

Advertisement

About wastefulspace

some random mid 20s b1tch.

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.