AFAIK CSS is really valid only in the header, but also for CSS and JS, they should be in the head, so that by the time everything on the page requires them, they are definitely available.
For example, if you have a JS function call in the body of the page, but this function has not been declared before, then, of course, you will get a script error.
In terms of performance, I don't know how much performance improves if you have it in your head, but I could be wrong. Sometimes you can improve the performance of some scripts by specifying them at the bottom of the page, but this only happens because other content is displayed manually (rather than rendering the browser when loading external resources).
source share