Does my HTML5 doctype have to be on the VERY first line?

后端 未结 6 1207
心在旅途
心在旅途 2020-12-18 18:32

I\'ve always wondered whether whitespace before a DOCTYPE matters, but I can\'t seem to find any definitive information on the web. People say not to do it,

6条回答
  •  春和景丽
    2020-12-18 18:39

    No, the Doctype doesn't have to be the first line of the file but it does have to come before the tag. That is the only limit you have, so your first method to do it is fine.

    The declaration must be the very first thing in your HTML document, before the tag.

    Gotten from: w3 schools (doctypes)

提交回复
热议问题