I am on an expedition to reduce the size of my CSS file. I thought of the following trick:
I have several elements which use similar properties, like
.a {
float:left;
/* Other properties */
}
.b {
float:left;
/* Other properties */
}
.c {
float:left;
/* Other properties */
}
So, I thought, why not make a separate class selector, say, k:
.k {
float: left;
}
and then include class selector k for whichever elements require float:left. Thus, we can remove the float: left line from .a, .b and .c Similarly we will have class selectors for all the common properties like float:right, font:normal normal normal 16px/normal arial,sans-serif. This would save lots of characters in CSS file, and lead to a small increase in size of html file.
What do you think about this approach? Would you do it? are there any pitfalls?
styleattributes. So, all the negatives forstyleapply. I would not recommend this approach, since it makes it very hard (or impossible) to restyle with stylesheets, since the style will be tightly locked to your markup.