Usually, when I create a site, I put all the CSS in one file, and all the properties related to the set of elements are defined immediately. Like this:
#myElement { color: #fff; background-color: #000; padding: 10px; border: 1px solid #ccc; font-size: 14pt; } .myClass { font-size: 12pt; padding: 5px; color: #ee3; }
I was considering the possibility of splitting my definitions into several different files (colours.css, layout.css, fonts.css ...), as I saw it, it is recommended. Something like that:
#myElement { color: #fff; background-color: #000; border-color: #ccc; } .myClass { color: #ee3; } #myElement { padding: 10px; border: 1px solid; } .myClass { padding: 5px; } #myElement { font-size: 14pt; } .myClass { font-size: 12pt; }
To reduce HTTP requests, I would merge the files and remove the space before deployment, so this is not a problem, but my question is: do all of these selectors really repeat over and over again, causing performance problems in browsers?
Alternatively, are there any tools that avoid this (potential) problem by merging definitions from different files? i.e.: take the input specified in my second example (3 different files) and combine them into one file, as in the first example.
nickf source share