How to use a custom CSS stylesheet in SharePoint 2010

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 <head> 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.

No comments:

Post a Comment