Skip to content Skip to sidebar Skip to footer

How To Center A Wrapper-div And Not The Content

I want my page to always be centered in the browser without affecting the content( like align-text: center; does). I want to center my wrapper-div.. How do I do this? Simplifed exi

Solution 1:

#wrapper {
     width: ...
     margin: 0 auto;
 }

no need to set text-align

Solution 2:

Set your style something like for the wrapper div.

#wrapper {

width: 841px;
margin: 0 auto;

}

In this way the wrapper div will always be centered according to your screen width. I hope it helps.

Solution 3:

you can set the margin property for the wrapper div like following in CSS

#wrapper { margin:20px auto } 

Post a Comment for "How To Center A Wrapper-div And Not The Content"