Having spent several months with SharePoint 2010 betas, and in conjunction with my post on the new features in SharePoint Designer 2010, I wanted to take a few moments to share my initial observations on CSS and master pages in SharePoint 2010.
SharePoint 2010 uses corev4.css, located at layouts/1033/styles/Themable/corev4.css on the server.
We can customize CSS just as we could on MOSS 2007, but in SharePoint 2010 we will customize it in the core4.css file. Unlike MOSS, when we customize CSS for a SharePoint 2010 site, the _Styles folder is not automatically created on the current site. When customizing CSS in SharePoint 2010, the _Styles folder is gotten from folder 14 on the server and runs from there.
This is a template which we customized for a PM Central Page in SharePoint 2010:
Default master page in SharePoint 2010 is v4.master.
– When we create a new site and customize it, SharePoint gets master page on the current site when it's run; it doesn't get the master page from folder 14.
– In SharePoint 2010, there are no longer any table elements as there were on MOSS 2007. All items use the <DIV> element.
– The structure of the master page has the same placeholder controls as does MOSS 2007.
– We can insert a .css file to get any CSS we wish to apply. The default CSS behavior in SharePoint 2010 is to get core4.css to run on the site, but we can insert any other .css file we wish to run, and this .css file will then supersede the default core4.css file.
– All pages on the site and pages on /_layouts/ use master page v4, so we will have a problem if we customize a master page and add a link to the CSS file on the site for a page on /_layouts. This "gotcha" is another difference from MOSS 2007 and WSS 3.0, as shown below.
We put a CSS file (styles.css) on a document library (Pics).
Within the CSS file, we insert styles to show the PM Central logo within the banner.
On the master page (v4.master), we add a link to reference the CSS file on the Pics Document library.
Using a relative path, if we view some pages on the site (e.g., home.aspx, allitems.aspx), the PM Central logo renders as desired, but the logo does not render on pages seved from the _layouts folder.
The good news is that modifying the link so that instead of using a relative path, it uses an absolute path to reference the CSS file will fix this problem.
To illustrate the issue that presents when using a relative path rather than an absolute path, this is a screenshot of a page in the site (home.aspx) with the PM Central logo present:
And this is a screen shot of another page, _layouts/viewlsts.aspx?BaseType=1, which is served from the _layouts folder and where, as you can see, the PM Central logo is missing: