Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does internal CSS go?

Tags:

css

head

I know that internal CSS should be in the <head></head> section of a (X)HTML document, but does it need to be before/after certain <meta> or <title> elements or can it be any order?

like image 524
Michael Avatar asked Dec 13 '22 10:12

Michael


2 Answers

According to the HTML5 spec, non-scoped <style> elements can go basically anywhere in the <head>.

like image 61
phihag Avatar answered Jan 03 '23 07:01

phihag


It doesn't matter. As long as it's in the head, it can be before all the <meta> tags, or after the <title> and <script>s.

In short: <style> elements can be anywhere in the <head> element.

like image 33
Madara's Ghost Avatar answered Jan 03 '23 08:01

Madara's Ghost