Here is the bootstrap docs, it says that we add the link in the end of the body just before it's closing tag. I am a newbie, but I thought I have seen a lot of linking being done in the head (in some non-bootstrap codes) so I am already a bit confused. Why is the css linked in the head while the JavaScript is linked in the body?
Asked
Active
Viewed 280 times
0
-
1[Why JavaScript at the end](https://stackoverflow.com/questions/30653081/why-scripts-at-the-end-of-body-tag), Have a look, this will answer your question – Sakil Aug 26 '22 at 04:32
1 Answers
0
My understanding is that a Webpage loads/reads the HTML from top to bottom. So you declare your styles in the <Head>
so by the time the browser hits the Body
, it will for sure know how to style everything.
The JavaScript goes at the bottom because often you will have JS Code interacting with HTML Elements and you want those elements to be loaded before the scripts run.

Marcos Gruah
- 13
- 3