thescientist Posted July 9, 2010 Share Posted July 9, 2010 Uh, you still need to have the <html> tag (it is never valid to have a closing tag without a matching opening one). Just put the DOCTYPE declaration above that. If it's still invalid, show us.P.S. no matter how the HTML is generated, it still should be valid .actually, not if you are using HTML doctype, right? with XHMTL its a bit different, but with HTML, this validates...<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <head> <title>Test</title> </head> <body> <p>Hello World</p> </body></html> although technically will throw a warning because of no character encoding. Link to comment Share on other sites More sharing options...
Synook Posted July 9, 2010 Share Posted July 9, 2010 Wow, that's just weird, I didn't realise that. But technically, the DOCTYPE is a markup declaration, and not a substitute for any tag. To be conservative, I would still put the HTML tag in. I mean, there are many things that can be left out when writing SGML markup (as I demonstrate*)... but that doesn't mean we should write our code like that all the time.* now updated, with no HTML tag! Link to comment Share on other sites More sharing options...
thescientist Posted July 9, 2010 Share Posted July 9, 2010 thanks for clearing up the DOCTYPE's status. I was under the impression that since it needs to come at the beginning of a page, a browser would understand it as being akin to an opening <html> tag. Better to be thorough as you say!**now updated with HTML tag! ....from now on... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.