How to set up XHTML 1.0 transitional doctype in ASP.NET 4.0

The doctype directive occupies the second section in .aspx page or ASP.NET web forms and appears just after the page directive, described in the article How to use Page directive in ASP.NET 4.0

The directive indicates the type of markup, HTML, XHTML, etc., used in the web page. This directive is optional, but Visual Studio 2010 adds it automatically. This is important because:

– Depending on the type of markup you’re using, there may be certain tricks that aren’t allowed.

– It influenced how a browser interprets your web page. If you don’t include a doctype on your web page, Internet Explorer switches itself into a quirks mode. While IE is in this mode, certain information details are details are processed in inconsistent, nonstandard ways. For example If you have a web page that looks dramatically different in Internet Explorer than it does in Firefox, the basic reason may be a missing or invalid doctype.

 

By default newly created web pages in Visual Studio 2010 use the following doctype:

 

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”

“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

 

This indicates that the web page uses XHTML 1.0 transitional. In this case the word transitional refers to the fact that this version of XHTML is designed to be a stepping stone between the old-fashioned HTML world and the ultra-strict XHTML world. XHTML transitional enforces all the structural rules of XHTML but allows some HTML formatting features that have been replaced by Cascading Style Sheets (CSS) and are considered obsolete.