You've got some stray text content inside the <head>
, before the <link>
tag. The browser sees the text and decides this means you're starting the main document body but have forgotten to include the <body>
tag.
This is actually valid—if inadvisable—in HTML4: the <head>
end-tag and <body>
start-tag are both optional. This is how you can have just <html><head><title>x</title>Hello!
as a valid HTML document. But it's not permissible in XHTML, so if you validate your document you should get a “character data is not allowed here” error at the point the stray text occurs.
The browser then parses the rest of the document as body content, putting the <link>
inside the body (which is not valid, but which is nonetheless commonplace). It ignores the real <body>
when that comes along because it already has a body.
If you can't see the stray text, perhaps it's an invisible character like U+00A0 No-break space
or—most likely for Chinese documents—U+3000 Ideographic space
, which you may get when you press space in some input method modes. These characters won't be visible, but they're not ‘ignorable whitespace’ like a normal U+0020 Space or newline, so they trigger ‘text content’ processing and force the <body>
.