The Best Way to Add Custom CSS to SharePoint

To thoroughly customize your SharePoint site, you’ll need to use a custom CSS. SharePoint offers a way to specify a single CSS file to use via the “Master page” settings for the site. However, using this approach still limits you to customizing only those IDs and classes that are included on the pages by SharePoint. Moreover, using this setting applies to both site and system pages, which may not be desirable.

With these downsides in mind, the best approach is to create a custom master page and include references to one or more custom CSS files. Follow the steps below to include a custom CSS file in your master page.

    1. Open SharePoint Designer (SPD) and connect to the root level of your site’s site collection.
    2. In SPD, open the “Style Library” folder.
    3. Create a new CSS file and name it (e.g. “customstyles.css”).
    4. Open your master page file in SPD.
    5. In the tag add a link to your custom CSS just above the content place holder named “PlaceHolderAdditonalPageHead” as follows:
<link href=”/Style%20Library/customstyles.css” rel=”stylesheet” type=”text/css” />
Your custom master page is now using your new CSS file in addition to all of the CSS files SharePoint uses out-of-the-box. The idea is that you are taking advantage of the “cascading” property of cascading style sheets by layering your custom styles on top of what SharePoint creates in order to alter the SharePoint look-and-feel as desired—like a skin.

How to Create a Custom SharePoint Master Page

The first step in customizing your SharePoint site is to create a custom master page.  The following steps will help you do just that (please note there are differences indicated between SP 2007 and SP 2010).

  1. Open SharePoint Designer (SPD) and connect to the root level of your site’s site collection.
  2. In SPD, open the “_catalogs” folder, then open the “masterpage” folder.
  3. Identify the out-of-the-box (OOTB) most like your ultimate design.
    1. (SP 2007) If your SharePoint’s site design is to be fixed-width and centered on the page, select BlueBand.master and copy it.
    2. (SP 2007) If your SharePoint’s site design is to be a liquid layout that fills the page regardless of the user’s screen resolution, select default.master and copy it.
    3. (SP 2010 beta) You want v4.master.
  4. In SPD, right-click on the master page you want to duplicate and select “Copy,” then paste it back into the same folder.
  5. Rename the new file something project-specific.  For instance, if this master page is to be used on the sales portal, you might rename the new master page SalesPortal.master.
  6. Publish and approve the new master page.
  7. In your browser, navigate to your site’s Site Settings page.  Under the “Look-and-Feel” column click “Master page.”
  8. Select your new master page as the site master page (the need to set the system master page will vary by project).  Save the settings change.

Your site is now using the new master page you created.  From here you modify the master page to your liking, including adding custom CSS and custom JavaScript and jQuery.