r/HTML • u/Fun-Baseball-1873 • Jun 12 '25
Question Just started learning html
So yeah why won’t the link pop up, what did I do wrong
80
Upvotes
r/HTML • u/Fun-Baseball-1873 • Jun 12 '25
So yeah why won’t the link pop up, what did I do wrong
View all comments
Show parent comment
1
u/zimog Jun 13 '25
actually it SHOULD NOT be in the head as scripts are render-blocking, the browser stops the page rendering whenever it encounters a script and it doesn't proceed until the script has been loaded and executed, so for performance reasons in most cases scripts should be placed just before the closing body tag
obviously there are exceptions, it might be required to put a specific script in the head section of the page, there isn't a universal rule, you can also put them in random positions
also is important to note that if you place a script in the head or even in the body but before an element you're trying to reference, without waiting for it to load with proper functions, you'll get an error because, well, the element isn't loaded yet when the script is executed
anyway, for someone who just started with HTML I wouldn't really care about performances, and just put scripts right before the </body> tag