0
where should the <style>...</style> and the<script src =""></script> tags be placed?
All along, and according to html, css and js tutorials I've gone through, I have always known that internal stylesheet tags (not inline) should only be placed on the head section. Same goes for external script i.e the one pointing at the location of your external javascript file. Just recently I was looking at a code of a SL member here and realized he had placed his internal css tags on the body section of html file. I came across another one who had placed the <script src ="...."></script> tags on the body section. Is it a good practice to do that?
6 Answers
+ 4
Dzeff kiptoo,and did it work? Coz what i knw an internal css should only be embedded in the head tag.
+ 3
dzeff kiptoo maybe he had used an inline css somewhere and that's what styled it, coz an inline css has more power than an internal one. Otherwise internal css won't work as a tag in the body
+ 1
Jason Kennedy yes i know of the <script>.....</script> tags and that it should come either at the head or the body sections. what i want clarity about is the external script tags i.e
<script src="external_javascript_path.js"></script>
should it also be placed just anywhere or strictly on the head section?
+ 1
oh sorry..yes that will be in the head as well. that is best practice..all such call tags should be in the head
0
the script should always go right above the /body..this is best practice.
stylesheet should be in the head.
reason..you want html and style to load before javascript or else javascript will run before the page fully loads which can cause issues at times.
0
Eddahkagehi kasigane yes it worked but i wonder how.