3

I'm planning a Site and I know the default landing page needs to be a fixed width.

I've also seen the awful things fixed-width does to Lists and Libraries (A List with too many columns looks atrocious with fixed-width.

My question is do I need to create the Master Page fixed-width or can I simply create a fixed-width Layout.

Also wondering how would relate to each other. Would I need to do some special CSS in the Master Page to take care of a fixed-width layout?

4 Answers 4

2

In SharePoint you can specify two different kind of master pages:

  • Site Master Page (applied to publishing pages)
  • System Master (list views)

So you can use two different master pages one with fixed width for the publishing pages (Site Master) and one that use the full width that will be applied to the lists (System Master). This is the normal approach how I do it.

The other thing is that the you can also change page layout to be fixed with too. The approach for that is that you reference a css in the additional page header section in the page layout. The code below is all you need to do to have a fixed width layout in master or page layout (suitable for SharePoint 2013).

/*** Default setup ***/
#s4-workspace{
    /* background-color of the workspace */
    background-color: silver;
}

#s4-bodyContainer{
    /* defines 960px by using 60rem = 60 * 16px (Default Font Size) */
    width: 60rem;
    margin:auto;

    /* background color of the content */
    background-color: white;
}

/*** Fix for the dialogs ***/
.ms-dialog #s4-workspace{
    background-color: white;
}

.ms-dialog #s4-bodyContainer{
    margin: 0px;
    width: auto;
}

.ms-dlgContent #s4-bodyContainer{
    width: auto;
}

/*** clear fix ***/
.clearfix{
    clear: both;
}

The clear fix need to be inserted in a specific place in the master page. You will find this on the SharePoint 2013 blog post.

This code also maintains the width of the modal dialog so nothing to worry about. You will also find some addition information on that in two of my blog posts for Fixed width for SharePoint 2010 - the fast way and Fixed width for SharePoint 2013 - the fast way

What you should consider when you plan your design is that it will distract the user when you switch between fixed with and full width. It also depend on the use case you have. If it's an intranet project you should stay with full width over fixed width.

If you are worried about the content that the lines gonna get to long to read then you can limit the content to be fixed width. This is the possible best ways to do it and improves the readability of the content.

The full fixed width approach is mainly suitable for public facing web sites where you want to limit the user to a specified screen size.

0
1

If you want to have a fixed width for some pages in your site collection, you should use fixed width for a page layout and apply this page layouts for the page you want to be fixed width. Otherwise, If you want to have a fixed width for all pages in your site collection, you should use fixed width in the master page.

1

Fixed width is super tricky in SharePoint. System pages, lists, libraries, even the Modal Dialog gets affected by it if you don't do it properly.

I would say it depends greatly on your design. But there are always workarounds.

Yes, you need to add the Css to your masterpage because you want every page to be affected by your custom Css and that is done by having the Css file reference in your masterpage.
Preferably add the Css to the masterpage using a Delegate Control - It's best practice and it keeps you from doing more damage than necessary (especially if you are new to SharePoint branding).

When it comes to fixed width design in SharePoint I would suggest that you place as much HTML to the page layouts as possible in order to avoid affecting system pages too much - but again, it depends on your design.

1
  • 1
    Actually that's what I did. I designed a Page Layout and suppressed the Quick-Nav by entering a blank PlaceholderLeftNav ContentPlaceHolderID and made some other css adjustments in the PlaceHolderAdditionalPage. #contentBox { margin-left: 0px; width: 960px; overflow: auto; }
    – user10711
    Jan 29, 2014 at 20:06
0

I was facing the same problem as you.

I wanted my site to be fixed width, but I faced problems with Lists and Libraries, as you have mentioned.

I have solved the problem using jquery.

You can checkout my approach here: Expandable width site in SP2010

It gives a fixed width site, and the width increases, if there is any extra content.

1
  • Please add the details to your post (with your blog as source) Jan 14, 2014 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.