Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

currently all my php generated rich html webpages start with this line, which I have been adding to my tempaltes YEARS ago...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

UPDATE

Who Should Use Which Doctype? When Should One Change Doctype? When I remove this line all still works fine. Is it still essentially needed to put all that at the top of my pages? What are my alternatives? Thanks very much for your suggestions.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

It'll be fine for a long, long time - browsers will ignore whatever they don't specifically understand. XHTML itself will die out eventually (including 1.1), but browsers still have to support all HTML versions in some form, so it won't completely go away.

The hip new (technically HTML5, but very usable right now) doctype is great though, might be worth changing:

<!doctype html>

Nice & clean, no more clumsy versions or DTDs.

More here.

share|improve this answer
    
This is a more useful link on the HTML5 doctype. And here's a mailinglist message explaining why there's no DTD for HTML5‌​. –  Lèse majesté Feb 16 '11 at 6:16
    
@Su' I don't think he was suggesting that @Sam change it to the HTML5 one, I think he was suggesting that the doctype itself should be changes. –  Piers Karsenbarg Feb 16 '11 at 12:23
    
@All dont want to start a miniwar folks, but just want to say that that being a person who does things out of guts/love and thus sometimes irrationally, I have bit fallen in love with the clean hip minimalistic-almost Bhuddism-sized doctype suggested: <!doctype html> ... its beautiful! I love it! +1 for all those links in and underneath this answer!! awesome novel reading materials. –  Sam Feb 16 '11 at 15:09
    
Prior comment trashed(as strongly as I disagree with this suggestion), though primarily because it was more argumentative than anything else. –  Su' Feb 16 '11 at 15:25
add comment

Literally the only thing a DOCTYPE does in a (post late 1990s) browser is signal whether or not to render in standards mode or quirks mode. That's it.

WHATWG did their research, and realized that browsers don't even need the DTD to render in standards mode. All you need to render standards mode is the minimalistic 'HTML5 DOCTYPE', <!DOCTYPE HTML>.

So, nothing will happen if you use the HTML5 doctype instead of the XHTML 1.0 doctype with a DTD, except your pages will be very slightly smaller, and if you use a validator, it will validate using different rules.

share|improve this answer
add comment

To answer your question: yes, your current DTD is fine.

But it's also the wrong question. Standards don't work like this.
It's not about making sure you're always using the latest one, and they don't really "expire" in the way that your question seems to suggest. They're about picking one and following its rules.

Even if your site were using HTML 4 and its associated doctype, there would be no particular reason to change any of that as long as the markup is valid within the conditions of the HTML 4 spec. If you wanted to recode your site with XHTML or HTML5 or whatever that's fine, but there's absolutely nothing compelling you to do it. (Which seems to be the core of your question.) If you'll recall, there was actually a period where many were actually pushing for a return to HTML because XHTML was really never done correctly in the first place. (When XHTML was in vogue, prior to what turned into the push toward HTML5.)

There's a secondary flaw in your question in that it's not only about the doctype. If you just change that, you could actually create problems due to changing semantics or deprecated elements, etc. You need to consider entire documents. Analogically, a book set in the 80s imposes certain requirements, such as "Do not make references to Facebook." And in the other direction, you can't simply decide to move it into 2010, because you have to make sure to fix that bit where you mention that Michael Jackson just released Thriller.

share|improve this answer
    
Good point. You should update the design of your site to keep up with changing fashions, but there's no reason to change doctypes for that reason. The only reason to change doctypes is if you need the capabilities of a different doctype, or if a doctype has become deprecated and you need to switch to keep up with best practices. But HTML5 isn't even complete yet, and XHTML 1.0 is still perfectly functional. –  Lèse majesté Feb 16 '11 at 12:07
    
+1 enlightening in general! –  Sam Feb 16 '11 at 15:05
add comment

Your Answer

 
discard

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.