DEV Community

Discussion on: CSS Is Hard - How do you learn to use and write CSS properly?

 
ciel profile image
Ciel • Edited

Putting script tags in your body tag means that it'll load based on the DOM and pretty much nothing else. It can quickly lead to race conditions.

If you need to ensure a script doesn't run until the DOM is ready, but aren't using a framework that loads things, you can add the defer property to your script tag in the head section.

There's some other reasons too, but in general it's definitely a code smell to investigate.

I would be happy to elaborate on it but I don't want to sound condescending.

Thread Thread
 
defiance profile image
Defiance Black

Would you make a post about it?

DEV needs more CSS.

Thread Thread
 
ciel profile image
Ciel

If I'm able to, I'll look into it, sure.