Mobile app version of vmapp.org
Login or Join
Megan663

: Is my Document Type Definition Still Up to Date? currently all my php generated rich html webpages start with this line, which I have been adding to my tempaltes YEARS ago... <!DOCTYPE

@Megan663

Posted in: #Html #Html5 #Standards #Xhtml

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.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

3 Comments

Sorted by latest first Latest Oldest Best

 

@Lee4591628

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.

10% popularity Vote Up Vote Down


 

@Kevin317

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.

10% popularity Vote Up Vote Down


 

@Marchetta884

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme