Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I don't care about caching or performance - any reason I shouldn't use embedded CSS?

Tags:

html

css

As part of my job I maintain/develop an internal web application. It has relatively few users and just isn't that big. I've got a global CSS file that contains some re-used styles, but 90% of my page-specific styles really really ARE page-specific; they are things like pseudo-column widths (a lot of my output is just non-tabular enough to make tables a poor choice). I have taken to just throwing a <style> block at the top of these pages.

I know this is frowned upon, but every time I read about the reasons for separate CSS files the only one that really stands out is caching. In this case that doesn't matter; it is WAY down on the list of things I would do if I needed to speed up the application. Are there any other reasons, or can I stop feeling guilty?

like image 640
Alex Godofsky Avatar asked Dec 27 '22 12:12

Alex Godofsky


1 Answers

every time I read about the reasons for separate CSS files the only one that really stands out is caching

Really?

Every time I read about their usage, the fact that you can change something in a CSS file and all pages that include it will have the change is the most important reason to use them.

Having your CSS centralized is a good thing even if your specific pages have different specific rules. It helps you unify the basic CSS structure across the site and when looking for how a specific effect was achieved it will be easy to locate.

These are all worthy reasons to use CSS files, well above any caching/performance reasons.

like image 94
Oded Avatar answered Jan 13 '23 15:01

Oded