As we add more and more styling rules, and potentially more style sheet files, we need to remember to keep things as tidy and streamlined as possible. When our CSS becomes unwieldy, we lose track of styles we've already set, the original intentions of certain classes or IDs, and in which file we put which rules.
First, the number of CSS files should be kept low. The more files that need to be called on a page, the more lag it puts on the loading times. With today's internet speeds, this isn't a major hassle, but it's good practice, nonetheless. Faster connections have resulted in shorter attention spans, so we still don't want any unnecessary time to come between the user and our content.
That being said, as we've mentioned before, it may be logical to put certain rules in a separate file—especially if they're rules that don't need to be called on every page. So the next biggest favor we can do for ourselves is grouping our rules and adding comments to them.
Like with HTML, comments are a good way to label a section of our code to help us remember its purpose and make it easier to find. So commenting in CSS has basically the same purpose, but its syntax is just slightly different. Any text that you want commented should go in between /* and */.
|
/* Styles for Quotation Block */ |