CSS Best Practices
Goals
The meaning and purpose of a CSS selector should be easy to understand.
CSS rules should be loosely coupled and reusable whenever possible.
CSS selectors should be efficient. This is more important due to its side effect of improving modularity, which has a bigger effect on performance by reducing file sizes and HTTP requests.
Extreme example: "div *"
Readability
Readability
Modularity
.equal-height-column {
margin-bottom: -99999px !important;
padding-bottom: 99999px !important;
}
Modularity
Modularity
<div class="followers">
<div class="alert alert-error">
<p class="msg">...</p>
</div>
</div>
Performance
Performance
Performance
Don't be afraid to refactor!