Need help from CSS purist!
Posted
by
Darcy
on Stack Overflow
See other posts from Stack Overflow
or by Darcy
Published on 2010-12-22T20:56:30Z
Indexed on
2010/12/22
21:54 UTC
Read the original article
Hit count: 264
I'm beginning to use CSS more and more but I'm not sure if I'm using it as intended in all cases.
I have classes named things like 'box' that will wrap the content inside it with a border, which seems like good CSS to me.
On the other hand I have classes like 'margin-right-5' and 'float-left' that sets the css to margin-right: 5px
and float:left
respectively. I'm wondering if this is good practice.
Then in my markup I'd do something like:
<div class="box float-left margin-right-5">
<!-- CONTENT HERE -->
</div>
Sometimes I may want to float right or not have a margin at all and still use the 'box' class, so I use several classes in order to make the css more flexible.
Am I destroying the principles of CSS?
© Stack Overflow or respective owner