HTML DOCTYPE declaration

4

By the W3C standards we should declare: < ! DOCTYPE html > , but I saw on a website that they declared only this: < ! DOCTYPE > , the semantic value is lost or the browser reads the file normally as HTML5?

    
asked by anonymous 04.09.2016 / 05:29

2 answers

5

According to specification needs to be complete. Browsers usually accept without because they try to give compatibility to poorly written code, but it is wrong. And it may not produce the expected result, since it can interpret as you want when there is no declaration according to the specification. He tries to help you, but it can get in the way. The correct one:

<!DOCTYPE html>
    
04.09.2016 / 05:35
-1

There is no obligation, the use depends on its purpose, but without the "html" the browser will understand that it is the default HTML and not an old one as the "XHTML 1.1 DTD".

    
04.09.2016 / 05:40