+ 17

Which of this good practice?

Which of this good practice for css? Head or body? and why?

4th Nov 2020, 7:45 PM
Sanjar Egamberdiyev
Sanjar Egamberdiyev - avatar
7 odpowiedzi
+ 10
neck, because it connects both to each other
4th Nov 2020, 7:50 PM
Shadoff
Shadoff - avatar
+ 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!
4th Nov 2020, 7:55 PM
Shadoff
Shadoff - avatar
+ 6
Why Shadoff ? Are they equal ?
4th Nov 2020, 7:53 PM
Sanjar Egamberdiyev
Sanjar Egamberdiyev - avatar
+ 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/
6th Nov 2020, 4:27 PM
Gordon
Gordon - avatar
+ 6
Head
10th Nov 2020, 6:40 PM
#####
##### - avatar
+ 2
Head is better then body to insert css in a html doc. But the best is external css.
3rd Dec 2020, 7:39 AM
Jewel Rana
Jewel Rana - avatar
0
The both are connected
6th Nov 2020, 7:38 PM
EMMANUEL IMO
EMMANUEL IMO - avatar