Fix width of master page in SharePoint 2010

This SharePoint 2010 master page tutorial explains, how we can fix the width of the master page in SharePoint 2010. Here we will fix the width of the master page to 1000px using CSS in SharePoint 2010.

Rather than modifying directly with out of box master page, my recommendation is to create a new custom master page in SharePoint 2010 and modify on that custom master page in SharePoint 2010.

You can also check how to create Vertical flyout menus in SharePoint 2010.

To fix the master page width, we need to fix in CSS file, and according to SharePoint designer best practices, it is not a good idea to modify in the out of box CSS files. So we can make a custom CSS file and refer the CSS file in the master page. Or in the 2nd approach, we can write inbuilt CSS code in the master page itself.

First Approach – Fix Master Page Width SharePoint 2010

Here we will add a CSS file and put the CSS code inside the file.

Make a css file in the below directory:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\STYLES

And put the below css code there:

<style type=”text/css”>
/*fixed width */
#s4-workspace > div,#s4-bodyContainer > div,body #s4-titlerow > div{
width:1000px;
margin:0 auto;
float:none;
padding:0;
}
body #s4-mainarea{
/*make main area have background of white and add a border */
background:#fff;
border:1px solid #ddd;
border-top:0px;
min-height:580px;
/*contain content in all browsers but IE7 */
display:table;
}
/*add padding back to title table*/
.s4-title-inner{
padding:0 0 0 5px;
}
/*background color of site*/
#s4-workspace {
background:#efefef /*none*/;
}
/*body container */
#s4-bodyContainer{
position:relative;
width:100%;
}
/*fix overhanging tables*/
.ms-v4propertysheetspacing
{margin:0;}
</style>

And save the file.

Now open the SharePoint 2010 site in SharePoint designer 2010.

Then open the master page on which you want to modify and put the below tag:

<SharePoint:CssRegistration runat=”server” Name=”/_layouts/styles/MyCustomCSS.css” After=”corev4.css”/>

2nd Approach – Add CSS directly on the Master Page

In the 2nd approach, Open the SharePoint 2010 site using SharePoint designer 2010, And then Open the master page where you want to modify.

Search for </head>

And before that paste the .CSS code from the above and save and publish the master page in SharePoint 2010.

You may like following SharePoint master page tutorials:

After that when you open the SharePoint 2010 site, the website will be fixed size.

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

>