I see (and get) a lot of questions about customizing the look and feel of SharePoint Portal Server. More often than not, this leads to an answer of directly modifying the SPS.CSS files on the server. This always leads to the caveat that this file may be updated with a service pack install or software upgrade. There is a much easier and safer way to do this which will never break.
In your SharePoint setup, Microsoft has provided a way to specify your own custom style sheet. If you know how style sheets work when a page is rendered, the last style specified (no matter how many style sheet files get loaded) always wins. This is by design but knowing this, and how SharePoint works, is a powerful combo that will let you cleanly mod your portal as much as you want without having to backup/restore files everytime your do an upgrade.
When SharePoint renders it’s portal pages it renders all of it’s own internal stylesheets. These are (in order):
Next, it renders any stylesheet you specify in the Site Settings page. Finally it renders the page content. Knowing this means that any style you put into your own stylesheet will override those specified in the Microsoft ones. So now you don’t have to go modifying the base files to get the effect you want. Here’s a simple example.
Create a blank stylesheet. Put a single style in it. Let’s override .ms-WPTitle which is the style used to render Web Part titles. Your stylesheet should contain this:
font-family: verdana, arial, helvetica, sans-serif;
This creates a style for the web part titles that displays a white uppercase title against a black background using Verdana as a font. Save this file as “mystyle.css” (or whatever name you want).
Now you need to tell SharePoint to use this stylesheet.
- Select “Site Settings” from your portal
- Click on “Change portal site properties and SharePoint site creation settings” from the General Settings section
- The last option is for a Custom Cascading Style Sheet. Put in the location of your stylesheet you created above. An additional trick is to use SharePoint to store your own stylesheet so put it in the Document Library of your own portal. That way you don’t have to deal with server administrators whenever you want to change your sites look and it gives you a simple document management process to keep tabs on who’s working on this file. So our entry would look like this: “/Document%20Library/mystyle.css” (assuming you uploaded it to the site, otherwise use a fully qualilfied UNC to locate the stylesheet, maybe from your corporate web servers)
- Click OK to save the changes
Now refresh the site in your browser. You should see the changes applied to all web parts on your site (Press F5 to refresh or you might have to do a “deep” refresh with Ctrl+F5). Continue to edit this file, making changes with your favorite style sheet editor like TopStyle (or Notepad if you prefer). In no time you’ll have a custom stylesheet with the branding you want on your site.
A variation on creating styles from scratch is to take a copy of SPS.CSS and modify the styles you want by changing your copy of this file. This uses the same technique as above (not modifying the file directly) but gives you a list of all the styles that SharePoint uses rather than building up from scratch. Pick whichever method works for you but the important thing to remember is that you don’t have to touch the base SharePoint files.
Note, this is only for SharePoint Portal Server. WSS sites need a custom theme which is a whole ‘nuther post and a different technique that I’ll walk you through if there’s a desire.