07.22Fixed width, centered SharePoint 2010 Site
I take no credit for this, but props to Tom Wilson for pointing out this annoying little Sharepoint 2010 centering the page issue.
And I quote:
I was faced with the challenge of creating my first fixed width SharePoint site and the content had to be centered!
SharePoint 2010 implements a complicated system of divs, css and JavaScript to attain their static ribbon at the top of the screen but unfortunately this can get messy with different layout types.
In the master page remove the s4-workspace ID from the the div. This is the ID the java script looks for to resize the content.
Second, add the following to your branding css file or a style tag in the header after the core.css
/* Page Wrapper */ body{ overflow:auto; } form{ width:950px; margin-left:auto; margin-right:auto }That’s it!
The fixed width gets centered by the auto margins and the page properly shows the scroll bars because of the overflow:auto!

Leave a Reply