Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tag head after closing tab body

Tags:

html

Hi everyone
is it possible, in HTML, to insert the <head> after the closing tag </body>? Or do I have to code before the <head> and after the <body>?
I was reading at w3schools.com about css, and it sais:
"Note: If the link to the external style sheet is placed after the internal style sheet in HTML , the external style sheet will override the internal style sheet!"
the question is how can I put and external style sheet after an internal style sheet if the external style sheet is declared in the head which is always before the body?

like image 642
zer0uno Avatar asked Nov 27 '25 02:11

zer0uno


1 Answers

No.

An HTML element must consist of exactly one HTML element with its children being one HEAD element and one BODY element, in that order.

The start and end tags for all three of those elements are optional, but you can't explicitly place them in any other order.

Browsers will attempt error recovery if you place the HEAD after the BODY, but you shouldn't depend on this.

external style sheet after an internal style sheet if the external style sheet is declared in the head which is always before the body?

You are confusing internal stylesheets (defined with the <script> element, which (like <link> which is used for external stylesheets) must appear in the <head>) with inline styles (defined by the style= attribute, which can appear on almost any element, including most that appear in the <body>.

Nothing about the order that stylesheets appear in can alter the influence of inline style, since they will always have a higher specificity.

like image 157
Quentin Avatar answered Nov 28 '25 14:11

Quentin