Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering about the consequences of building a site thats complaint with XHTML1.0 Strict. I have developed a lot of sites using the transitional doctype, and read about the consequences of a link target attribute. It can't be used and it has to be fixed with a javascript code block.

I was wondering if there were any more of these 'heavy impact' occurences and if there are significant changes with day to day coding in the transitional variant...

(Didnt know if it could be asked here, or that it has to be placed on stackOverflow.com because of the frontend related issue)

share|improve this question
Probably better suited for doctype.com – Tim Post Jul 9 '10 at 12:27
up vote 3 down vote accepted

First up, using Javascript to add invalid attributes to elements is exactly as bad as putting them in the HTML in the first instance. You're just masking the "problem".

Second, I said this in another answer but the key to good validation is knowing what are the important errors to tackle. Will adding target="_blank" to a link negatively affect someone using a particular browser? No - either the link will open in a new window, or it won't. It won't break the layout or crash their browser or anything.

A strict doctype* is the only sensible choice for new web pages, because it massively reduces cross-browser problems, moreso than any other technique. But using a strict doctype doesn't mean your code must be 100% valid to the spec. It's okay to use technically invalid attributes as long as you are aware of the consequences (or lack of) when a browser might not support a feature.

* Personally I love the HTML5 doctype: <!DOCTYPE html>.
Incredibly easy to remember and it forces strict mode in all browsers, even IE6.

share|improve this answer

The consequences are better web standards support, more cross-browser compatibility, and easier checking for accessibility. The Strict standard encourages very clean code.

However, sometimes you simply need to break a rule in order to make it work right. In these cases, using Strict doesn't stand in your way from being able to do something, it just prevents you from passing the validation.

share|improve this answer
You can do anything in a strict environment that you can do in a transitional environment- the former just requires javascript substitution in some places. (<a href="url" target="_blank"></a> --> <a href="url" onclick="window.open('url'); return false;"></a>) – Soleil Jul 9 '10 at 15:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.