I taught the style was coded inside the head tag why is it working in the <body>? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I taught the style was coded inside the head tag why is it working in the <body>?

14th Aug 2016, 6:11 PM
Olaiya Jamiu
Olaiya Jamiu - avatar
3 Answers
+ 2
css extent file use in head tag. style tag in body. diffrents external file is for largest css files. style tag for minor stuff. you understand ?
15th Aug 2016, 12:54 AM
HawkEye
HawkEye - avatar
+ 1
To an extent, it will work wherever you put it. The reason it should be in the head is so the styles apply to the whole dom. If you have elements that should be styled by the css file appearing before the stylesheet is linked, they wont style correctly. That's what the cascading in css means. The styles "cascade" down the dom.
14th Aug 2016, 7:36 PM
Jason
0
It works anywhere, but it is better to put it in the <head> element. It is always better to use it externally and link it with the HTML file via the <link> element between the <head> element. It helps apply the styles correctly.
14th Aug 2016, 7:46 PM
Genesis