0

Styling in a separate files makes the page load faster

Although I understand why it is better to put all the styling in CSS in a separate file, instead of in the page,(improves code readability, makes it easier to maintain and change), there is one argument I don't understand, it is that doing so would improve the download of your page and allow for it to be displayed more quickly.

24th Oct 2016, 9:40 PM
PrisseReine
3 Antworten
+ 3
While bundling everything in one file makes the download faster the first time, if you use the same css on several pages (or access the same dynamic page regularly), your browser can put in cache an external css file and display the pages using it faster than pages bundling the css (because it doesn't need to redownload it) on subsequent times. This also goes for other external files, like javascript files for example.
25th Oct 2016, 10:11 AM
Zen
Zen - avatar
+ 2
It's because the external stylesheet is cached by the web browser.
24th Oct 2016, 10:03 PM
Liam
Liam - avatar
0
Is it because by doing so you allow the browser to load first the content and display it, then the CSS and how to style it? So in case of slow connection, the user will see the content appear faster, and it'll be styled later, instead of seeing a blank page. The overall loading speed wouldn't improve, but the display speed would.
24th Oct 2016, 9:45 PM
PrisseReine