I did make a stupid mistake where I placed a style tag in the body to make it really clear what part of the page it styled.
My question is: can I let it be like that or is it really important to move it to the head, to ensure that most major browsers will display the page properly?
I know that it's supposed to go into the head, but we're talking about a 100 files and if most major browsers supports this, I estimates that it wouldn't be worth it.
It will work but it's not best practice. Ideally if you want to include inline styling / non render blocking CSS, try to include the tag just before the closing head tag.
Yes, it is supported. However it is a best practice to not to use directly inside of the HTML tags, use CSS files instead:
https://developer.mozilla.org/en-US/docs/Learn/CSS/First_steps
If you have a lot of similar elements, where you want to use the same styles, you should use a separate CSS files and use class/id tags inside of your HTML, and call it in the HTML file.
Check out some advice from mozilla development:
https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Organizing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.