We maintain a fairly large site with a lot pages. As the pages grew, so did the HTML and CSS. Is there any good way to document these? Like which page uses a particular selector, etc. What's the best practice for maintaining CSS for a large site?
It depends on what is your website supposed to do. If it is a small blog and you need, say, 3000 lines of CSS, that is probably too much. If it is an online store with multiple sections and a complicated layout, it might not be enough. It depends on your needs.
Is there any size limit on CSS file or on the number of lines? The answer, for IE9 and lower, is yes, depending on what you mean by "lines" and "size limit". Size: the max size style sheet that IE9 and less will read is 288kb. Any styles after that mark do NOT get read.
It depends on your use case. Usually everyone just smash a single css into the page and load it everywhere. If the site small and the css is only a few kB should be fine. once you get to the 100kb+ u probably better sppliting files into the most critical css and fonts so the first content is available without delays.
In my experience, CSS is not maintainable. If CSS were a room in your house, it's the basement...it collects things over the years and after a while you tend to have more stuff in it that is of no use vs. stuff you want to keep.
As such, I recommend starting fresh every few years.
Barring that, some suggestions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With