Skip to main content
12 events
when toggle format what by license comment
S Oct 7, 2020 at 17:24 history suggested corn on the cob CC BY-SA 4.0
added code blocks and code languages
Oct 7, 2020 at 16:37 review Suggested edits
S Oct 7, 2020 at 17:24
Feb 9, 2018 at 11:57 comment added Simon Hayter I made a demo for you to test with, simply check 'network' using Firefox Firebug or Chrome Inspect and click 'network' and then refresh the page. You will see that 3x CSS files are loaded regardless of the viewpoint. Try resizing the width of the page and reloading it in different viewpoints, all CSS are loaded. But with this said, even if browsers worked the way you would think they would these media files are often in a few kb's, hardly worth splitting in any case.
Feb 9, 2018 at 11:56 comment added Simon Hayter @Evgeniy, you'd think it would work that way but sadly it doesn't. Browsers will download all spreadsheets regardless, because devices can change resolution and orientation, therefore they download these as the page firsts downloads. So all you are doing is making additional unnecessary server side requests.
Feb 9, 2018 at 8:41 comment added Evgeniy @SimonHayter i always thought, that it is better to have CSS files for desktop, mobile and print, and to serve them to those users, who are coming with certain devices, based on media queries and/or device recognition. With this setup you have more then one CSS file, but you server always only one of them, and this one much smaller, than it would be, if it would contain styles from CSS files for all devices. I mean, you have the same 10.000 visitors, but they don't get all three CSS files, but they get served only one CSS file, just for their device, and it is small.
Feb 8, 2018 at 22:16 comment added Simon Hayter Depends on how you look at it... if you have 10'000 visitors an hour and 4 CSS sheets that's equal to 30,000 additional GETS, the more visitors you have the more difference one style sheet becomes.
Feb 8, 2018 at 19:48 comment added Zhaph - Ben Duguid But I agree that in this case it's unlikely that there will be much difference between the files to justify splitting them out.
Feb 8, 2018 at 19:47 comment added Zhaph - Ben Duguid Yep, either for rather old, large CSS files, or moving to a more modular architecture where you only want to serve relevant content to your users. Sadly some larger sites I've worked on can have upwards of 70% "unused" CSS for any given page :(
Feb 8, 2018 at 19:42 comment added Simon Hayter @Zhaph-BenDuguid ~ I dunno what situation would ever make CSS more suitable in multiple files as demonstrated in this answer. The only ever time I would agree is using external CSS such as font awesome and Google fonts since these are cached on most people's machines before they even visit your site. So unless your site has massive CSS files that above the cache threshold on some older devices then I don't see the point. Less requests is better for the visitor and server regardless of HTTP/2 or not.
Feb 8, 2018 at 19:40 comment added Zhaph - Ben Duguid @SimonHayter I wouldn't agree that it's "always better to use one CSS file" - while in this case it's true that the media queries are probably better off managed through SASS and a build process, with the move towards HTTP/2 it may be better to serve multiple smaller files as the connection overhead is reduced and more parallel requests can be handled.
Feb 8, 2018 at 19:32 comment added Simon Hayter It is always better to use one CSS file: e.g <link rel='stylesheet' href='style.css' type='text/css' media='all' /> and if you want the luxury of having easier administration using multiple files then use SASS.
Feb 7, 2018 at 12:18 history answered Evgeniy CC BY-SA 3.0