+ 17
Which of this good practice?
Which of this good practice for css? Head or body? and why?
7 odpowiedzi
+ 10
neck, because it connects both to each other
+ 8
I guess I know what do you mean. It is better to use link to the css file and separate html code from css code! This is best practice. Dont make a spagetty code!
+ 6
Why Shadoff ? Are they equal ?
+ 6
1. All CSS stylesheets should be imported in <head>
2. Stylesheets should be minimized in production.
3. Because stylesheets are blocking rendering elements, or in simple words make page loading slow, we should defer the loading of non-critical definitions, by following script :
<link rel="preload" href="styles.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="styles.css"></noscript>
To know which are critical and which are non-critical, read reference material:
https://web.dev/defer-non-critical-css/
+ 6
Head
+ 2
Head is better then body to insert css in a html doc. But the best is external css.
0
The both are connected