Search code examples
cssclassclass-design

CSS - common classes


In my web app I use several CSS classes to write less code. I use them quite often in the markup to add single property or two in some cases.

These are the following

.clear { float: none; clear: both; }
.fl_l{ float: left; }
.fl_r{ float: right; }
.ta_l{ text-align: left; }
.ta_r{ text-align: right; }
.no_td:hover { text-decoration: none; }

What similar classes do you use? Have you ever seen this technique in other projects?


Solution

  • yeah, if you don't use common classes like you do then your CSS files get extremely large and every class becomes extremely specific

    some other common classes...

    .split { float: left; width: 50%; }
    .center { text-align: center: margin: auto; display: block; }
    .bold { font-weight: bold; }
    .top { vertical-align: top; }
    .bottom { vertical-align: bottom; }