Hi All,
In the article http://blogs.adobe.com/experiencedelivers/experience-management/clientlibs-explained-example/ it says, "CSS resources have to go in the <head>, Javascript resources at the end of the page".
I was not quite able to understand why is this the case. Any thoughts on this will be helpful.
Solved! Go to Solution.
hi askdctm
CSS must always be loaded before body(in the head), because when you have the CSS declared before <body>
starts, your styles has actually loaded already.
So very quickly users see something appear on their screen (e.g. background colors). If not, users see blank screen for some time before the CSS reaches the user.
Also, if you leave the the styles somewhere in the <body>
, the browser has to re-render the page (new and old when loading) when the styles declared has been parsed.
JAVASCRIPT I would answer this with multiple options actually, the some of which actually render in the body.
<input onclick="myfunction()"/>
- better to put it in event handlers in your script body instead.Some Reference Link:- http://stackoverflow.com/questions/2451417/whats-pros-and-cons-putting-javascript-in-head-and-puttin...
I hope this would help you.
Thanks and Regards
Kautuk Sahni
hi askdctm
CSS must always be loaded before body(in the head), because when you have the CSS declared before <body>
starts, your styles has actually loaded already.
So very quickly users see something appear on their screen (e.g. background colors). If not, users see blank screen for some time before the CSS reaches the user.
Also, if you leave the the styles somewhere in the <body>
, the browser has to re-render the page (new and old when loading) when the styles declared has been parsed.
JAVASCRIPT I would answer this with multiple options actually, the some of which actually render in the body.
<input onclick="myfunction()"/>
- better to put it in event handlers in your script body instead.Some Reference Link:- http://stackoverflow.com/questions/2451417/whats-pros-and-cons-putting-javascript-in-head-and-puttin...
I hope this would help you.
Thanks and Regards
Kautuk Sahni
Hi Kautuk,
Thanks a lot for the detailed explanation.
Views
Replies
Total Likes