Recent
News
SharePoint 2010

Fixed width, centered SharePoint 2010 Site

I retackled this fix and now have a much better way of doing this that I have been using for many projects.
Please see my new solution here

— Old Solution for archive purposes ——————

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!

20 Responses to “Fixed width, centered SharePoint 2010 Site”

  1. Fixed Width Master Pages in SharePoint 2010 - Doug Ware Says:

    [...] 1:38 PM Body: Edit: Since I wrote this post I found this one which has a solution I like better: http://styledpoint.com/blog/fixed-width-centered-sharepoint-2010-site/. I also recommend you take a look at Randy Drisgill's starter master pages which you can read [...]

  2. Freddy Buskens Says:

    You solved my puzzle, thnxs.

    Do you think it would also be possible to edit the Java Script for resizing?

  3. Tom Says:

    I don’t believe it would be so much of editing the script as turning it off completely and writing your own.

    You can turn off most that functionality by removing some ID’s on some elements.

  4. Fixed Width Master Page — Two Variations « SharePoint 2010 Branding Authority Says:

    [...] http://styledpoint.com/blog/fixed-width-centered-sharepoint-2010-site/ The following code should be put in your custom CSS.  This will center the page and make it 950px wide.  If you want it wider, change the width.  I want mine left aligned, so I deleted margin-left and margin-right and added margin: 0px which does the trick.  ** I also had to add !important to body {overflow: auto !important;} to get the vertical scroll bars to work for some reason. I like this solution b/c the scroll bar is on the outside of the browser window.  The only issue is on a few Admin pages like All Master Pages where the content is too wide and won’t “fix” to your width.  See images A and B below.   A) Page whose content fits in the fixed width.  Scroll bar on the outside of browser window.  Looks great.  B) Page whose content doesn’t fit in the fixed width.  Content stretches past fixed ribbon/nav at top.  Doesn’t look so great, but better than having fixed scroll bars on the left and bottom, which solution #2 creates.  See image D. [...]

  5. susan Says:

    if you remove the s4-workspace ID, then test a dialog box in FF, they don’t auto-size properly. i found that in order to have a fixed-width site that still functions properly in Firefox, I had to keep s4-workspace and add the s4-nosetwidth class to that div.

    this fixed the dialog box issue for me

  6. Conor Says:

    I’m guessing this was done on the RC Build? The page architecture seems to have changed for the RTM (and eventual GA). Any new thoughts?

  7. Yogi Bear Says:

    The only problem I have with removing this div is that the ribbon editing goes all awry as the s4-workspace ID is requierd in the script to control the ribbon position … need a solution that keeps the ribbon postion for editing; but also have nice fixed width

  8. Leftfield24 Says:

    Great info! Just what I was searching for–BTW, check your page titles. :)

  9. Lucas Diniz Says:

    I centered the page without changing the css class. I put a inline style seting 100% !important in s4-workspace DIV. Unfortunately it work only in FF and Chrome.

  10. Alex Says:

    Hi to all,

    Just to add to complete all job with scrolling you must to edit master page and change the following section

    branding is name of css file that you attach to master page.

  11. Using a Fixed Width Page in SharePoint 2010The White Pages | The White Pages Says:

    [...] thanks to Tom Wilson, the correct solution was quickly obtained. Basically, javascript is looking for that s4-workspace [...]

  12. Soptik Says:

    Now when i am employing your solution the vertical scroll bars raher than sticking to the ie8 window is sticking to the body of my page.

    Also when i am minimizing the page i am unable to see both horizontal and vertical scroll bars.

    Any ideas ?

  13. vinod.d Says:

    I am using 100% width when i go to site settings -> Master pages and layouts -> list content goes beyond the margin screen any fix for this..please help me on this. As i observe that s4-workplace width fit to Screen resolution the content horizontally huge then the “s4-bodyContainer” fix to it not expanding as per content only expands as per browser screen resolution fixed hope you got my issue if not please leave me mail will send you screen shot of it.

    thanks
    vinod

  14. The SharePoint Muse » Blog Archive » SharePoint 2010 Branding and Customization Resources - SharePoint User Experience and Visual Design Says:

    [...] How to Create a Fixed-Width 3 Column layout – Tom Wilson, Styled Point [...]

  15. Tom Says:

    @Conor: Yeah. This was beta. See the new article attached at the top!
    @Yogi Bear: You are totally right. I don’t like removing any existing html as this usually breaks something in SharePoint!

  16. Felix Says:

    Hi,
    the scrollbars weren;t dhowing when using this solution. Changing body{} into body.v4master{} did the trick.
    regards, Felix

  17. Al Says:

    Any of you come accross the issue of content bleeding out of the set width like document librarys and such. This is the main set back with regards to Fixed width designs.

  18. SharePoint 2010 Centered Fixed Width Design | New ideas in data visualization and user interface Says:

    [...] now with a little help from a few other posts (The SharePoint Muse, Elumenotion, Styled Point) we can create a SharePoint 2010 fixed with centered [...]

  19. Chris Says:

    Cool article!

    But make it easy and don’t waste your time with searching for the right css tags.

    Just use this unique SharePoint 2010 Branding Tool:

    http://www.nextflow.at/eng/pages/plugnplay.aspx

    Cheers and have fun!!

  20. SharePoint 2010 Branding | Sharepoint Sriram Says:

    [...] How to Create a Fixed-Width 3 Column layout – Tom Wilson, Styled Point [...]

Leave a Reply

Whitepaper RSS Feed