What is the correct way to declare an HTML5 Doctype.

前端 未结 10 1891
一整个雨季
一整个雨季 2020-12-30 18:48

What is the correct way to use start tag when creating with HTML5

IE: HTML 4 Strict is like this



        
相关标签:
10条回答
  • 2020-12-30 18:55

    The clearest most definitive answer of what the standard says seems to be for HTML 5.3 at:

    http://w3c.github.io/html/syntax.html#the-doctype

    Note especially the list-items 1 and 3 which specify that the doctype-statement is case-insensitive. Also note the number of spaces inside the statement can vary.

    And note the clause "A DOCTYPE is a required preamble."

    0 讨论(0)
  • 2020-12-30 18:59

    It's as simple as

     <!DOCTYPE html>
    
    0 讨论(0)
  • 2020-12-30 18:59

    You only need this:

    <!DOCTYPE html> 
    <html>
    ...
    

    There are several points here. This is supported by all browsers, even old ones like IE6/IE7. All browsers actually nee "html" part from doctype declaration to jump into standards mode.

    0 讨论(0)
  • 2020-12-30 19:01

    you just use

    <!DOCTYPE html> 
    <html>
    </html>
    
    0 讨论(0)
  • 2020-12-30 19:02

    First of all, html5 doctype is not case sensitive.

    Either one of these three will work:

    1) <!DOCTYPE html>

    2) <!DOCTYPE HTML>

    3) <!doctype html>

    You can check the validity here.

    0 讨论(0)
  • 2020-12-30 19:02

    The start tag <html> is optional in HTML5, as in HTML 4.01. If used, it must be the first tag. It has different optional attributes: the global attributes of HTML5, and the special manifest attribute. The most common useful attribute in the <html> tag is the lang attribute.

    (The doctype declaration is something quite different, and not a tag at all.)

    0 讨论(0)
提交回复
热议问题