-2

Something like:

<link rel="stylesheet" href="style.css"/>

Or like this:

<style>
  /*code*/
</style>

Considering that both are in the of the document, is there any difference in performance?

Ericki
  • 119
  • 4
  • 1
    One requires a additional HTTP call, the other can make the initial load slower. – TryingToImprove Mar 03 '20 at 07:05
  • One can split up code, the other can create repeated code. – Rickard Elimää Mar 03 '20 at 07:07
  • Use your first example, those is what you'll call external stylesheet. Its much better, and if you need to make a simple change to multiple pages that have this linked, then you'll need to do it just once instead of going to each and every page to make the same change. – Gosi Mar 03 '20 at 07:08

2 Answers2

2
<link rel="stylesheet" href="style.css"/>

External CSS link is the best practice in HTML document. For faster loading in small pages you can use internal css

<style>
  /*code*/
</style>

Internal css will load faster than external CSS. The problem is, if we use large number of internal styles, then CSS will run faster than Other HTML elements. So avoid this.. Better to use external CSS.

Edwin Alwin
  • 192
  • 6
0

The best way is by adding external CSS because you don't have to write CSS for every page and you can change the look of an entire website by changing just one file . It will also increase the efficiency of website. So, i will prefer to use external CSS by using link .

VJ Zone
  • 1
  • 1