Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One massive CSS - or lots of little ones?

Tags:

html

css

Simple question hopefully.

We have a style sheet that is over 3000 lines long and there is a noticeable lag when the page is rendering as a result.

Here's the question: Is it better to have one massive style sheet that covers everything, or lots of little style sheets that cover different parts of the page? (eg one for layout, one for maybe the drop down menu, one for colours etc?)

This is for performance only, not really 'which is easier'

like image 418
Paul Avatar asked Nov 26 '22 21:11

Paul


1 Answers

3,000 lines? You may want to first go in and look for redundancy, unnecessarily-verbose selectors, and other formatting/content issues. You can opt to create a text stylesheet, a colors stylesheet, and a layout stylesheet, but it's likely not going to improve performance. That is generally done to give you more organization. Once you've tightened up your rules, you could also minify it by removing all formatting, which might shave off a little bit more, but likely not much.

like image 67
Sampson Avatar answered Nov 29 '22 12:11

Sampson