Has anyone ever seen this - HTML doctype="HTML1.2/TRANSITIONAL//"
I was looking at some old webpages constructed by a previous member of staff not too long ago and right at the top of the page I found this:
<HTML doctype="HTML1.2/TRANSITIONAL//">
Has anyone ever came across this? I've never seen or can find a definition of a doctype attribute on the HTML tag? I'm putting this down 开发者_运维百科to poor coding but I just want to make sure that I'm correct in my assumption.
Has anyone else seen this?
Thanks
I'm pretty sure it's not a valid doctype
. Especially considering the fact that the first official HTML standard was version 2. For a list of all the valid doctype
declarations, see this W3 page.
Not only is this an invalid doctype (HTML 1.2 was never a formal standard, and even if it had been it wouldn't have wanted a doctype, as doctypes weren't in common use for HTML documents until IE6 was released, which means that a doctype for anything less than HTML 4.0 is very suspect), but it isn't even written in the correct format for specifying a doctype - it's written as an attribute of the <HTML>
tag, whereas doctypes should be declared as a separate line at the top of the file.
The only v1.2 that he could possible have meant is xhtml 1.2, but this was never a widely used standard, and even just from the snippet you've given us, it's clear your code would never have been valid xhtml, so I doubt that's what he meant. Frankly, it looks like it's just plain wrong.
I'd recommend throwing it away, and using the HTML5 doctype. Your page will now now begin like this:
<!DOCTYPE HTML>
<html>
....
But if you do want to use a different doctype from that, you can find examples of all the main ones in use here: http://en.wikipedia.org/wiki/Document_Type_Declaration
One thing you should be sure of, whatever you decide to do, make sure you do include a doctype of some kind or another -- without one, IE will go into quirks mode, which will make it very hard for you to make your site work properly cross-browser.
精彩评论