Thinking about performance, in which part of HTML should I insert CSS and JS files. I know that JS files should be inserted before closing the </body>
tag so as not to block loading and if possible assíncrona
, but what about CSS?
Thinking about performance, in which part of HTML should I insert CSS and JS files. I know that JS files should be inserted before closing the </body>
tag so as not to block loading and if possible assíncrona
, but what about CSS?
In my opinion, the best practice is to place the CSS inside the head
tag:
<head>
<link rel="stylesheet" href="css/layout.css" type="text/css">
</head>
And the Javascript files before closing the body
tag:
<script type="text/javascript" src="script.js"></script>
</body>
Translated by: Where to put CSS and Javascript