View Full Version : Div won't center

11-06-2011, 03:26 AM
Hi! I'm working on my portfolio and have a problem...

The menubar won't get into the center! Check http://seer.se and see the column with "1, 2, 3, Hem, Sebastian, Kontakt". It should be just down under the header.

I think this problem is out of my knowledge since I really am an amateur at this so I would be so glad if someone could help me with it.

// S

11-06-2011, 03:53 AM
Hello seer,
To center an element you need three things:

a valid DocType
an element with a width
that elements right/left margins set to auto

Right now, your #header and #info are full width elements. #header is centered by the background properties you put on it.
#info might be centered like this:

#info {
background: #fff;
margin: 120px 0 0 -190px;
height: 30px;
left: 50%;

This would work if you got #header and #info out of#content -
#wrapper {
margin: 0px auto;
padding: 0px;
width: auto;
height: 715px;
overflow: auto;
#info {
background: #fff;
display: table-row;
margin-top: 150px;
margin-left: auto;
margin-right: auto;
display: block;
width: 300px;
height: 30px;
text-align: center;

11-06-2011, 05:17 PM
Ah, allright! Thank you so much! :)