Validate doctype XHTML 1.0 strict on w3 validator correctly

In our Visual Studio settings, the default doctype for pages is XHTML 1.0 transitional. However, in recent days, after getting the Internet Explorer 10 update, I found that I could not debug the page because the browser kept indicating an error about the wrong doctype. My site is not expected to run in HTML 5 mode, but, the recommendation was for using the HTML 5 doctype.

I found that using XHTML 1.0 strict doctype resolved the problem. Still digging deeper, I found a very interesting answer to the difference between strict and transitional mode in http://stackoverflow.com/questions/3735979/browser-rendering-difference-between-strict-transitional-doctypes

Notably, the following extract is of interest,

The final piece of the puzzle is that all modern browsers render pages with a strict DOCTYPE in ‘strict’ mode and pages with a transitional DOCTYPE in ‘almost strict’ mode.

The next problem was that the br tag gave an error despite closing it (
). Initially, I was led to believe that either we will have to get away from strict mode also or live with the errors in W3C validator. But reading the error details carefully I realized, that the validator expected it to be inside a container tag like div, p, etc. and not directly in the body. You can see the gallery below to see the difference yourself.

The following link is great to understand what you can and should not do in strict mode. I do kind of agree that how the page looks should be part of CSS and not the HTML.

http://24ways.org/2005/transitional-vs-strict-markup

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s