Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Doctype very first thing? [duplicate]

Tags:

html

doctype

Is it valid to have blank line returns preceding the doctype declaration?

The <!DOCTYPE> declaration must be the very first thing in your HTML document, before the <html> tag.

via w3schools

like image 640
ThomasReggi Avatar asked Dec 11 '25 07:12

ThomasReggi


1 Answers

Not necessarily; BOM, whitespace and comments may come first.

http://www.w3.org/TR/html-markup/documents.html#syntax-document-html

So yeah, it must come first, before any actual HTML tags, but note that you can't really ever put doctype before BOM.

like image 54
Máté Gelei Avatar answered Dec 14 '25 00:12

Máté Gelei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!