Sunday, October 4, 2009

MOSS 2007 Master Page DOCTYPE Issue

Hi All,
Today i would like to discuss an issue which i think most of us would have faced when we try to add a declaration in the top of the master page like:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

This is a standard declaration you will see on any aspx page and we all know why it is required.

But when you add this declaration in a SharePoint master are inviting trouble..why..simply because of the reason that SharePoint master page is XHTML non-compliant.
You will ask me why you need a DOCTYPE in a master page?
Reason being the fact that i am using a AJAX modal pop up in the master page and we all know what happens when you add a ajax control in a master page without a doctype declaration..The page looks weird and the structure breaks from many places.

The only solution i know in this case is to choose from one of the following options:

1. Remove the AJAX modal pop up and hence the DOCTYPE declaration and use some other pop up . A javascript pop up may be
2. Keep the DOCTYPE declaration and modify the style of the elements whose structure is broken as an effect of adding doctype. can't refuse clients requirement , and hence you have to go with option 2.

Consider for example after adding DOCTYPE the quick launch menu started looking weird, You tried changing the style sheet class attributes but no use.
The reason being the fact that the master page is no longer taking the out of the box style sheet classes like ms-navheader !
Follow the steps mentioned below and get rid of this problem:
1. Create a new class in your style sheet (Note: Do not make change in CORE.css)
and copy the attributes you were using previously in it e.g if the previous class name was ms-navheader then create a new class by name such as leftnavheader and copy the attributes under its declaration. Similarly create other classes.
2. Open the master page in the designer and replace the old class name with new one at all the places.
3. Save and publish the master page and you will see the changes are visible now.

Go ahead and follow the same procedure at all the places. I know its strange but can't help it.

If you have some better way of solving this issue or facing any problem understanding this post please let us know at

Happy Coding !!

No comments:

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to