The DOCTYPE tag and SharePoint Master Pages

I came across a new issue this week.  All of my custom master pages that I have done (including the base code I provide here) include a DOCTYPE tag that references the latest HTML specifications (<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>).  Unfortunately, the master page file used by default for SharePoint (default.master) does not specify a DOCTYPE tag at all.   So when the browser page renders the code, it reverts to quirks mode, which renders the HTML according to old rules.

This has a cascade effect. The default SharePoint styles have been coded to style old HTML specifications, instead of the new ones.  This means deprecated styles elements are used since old HTML rules are being applied to the page.  Most notably, the HEIGHT attribute for table cells is used in the SharePoint styles, and this is a deprecated property in HTML 4.0.

So far I have only found a small handful of issues where this becomes a problem if you are specifying a correct DOCTYPE tag. There are a few styles used in the Calendar display that rely on the HEIGHT attribute to set table cell heights.  Click here to see these issues. For the second issue listed, I have a fix.

As a web designer, I am not willing to revert to using quirks mode for rendering the pages.  It is not the appropriate solution IMHO.  Current DOCTYPE tags should be specified for pages. Instead I plan (or will try :-P) to create a new Events feature that styles the calendar differently to correct this issue created by the lack of a  DOCTYPE tag in the default code for SharePoint.

So this serves as a heads up warning to anyone creating master pages, or using my base master page code.