scouse
12-02-2008, 08:51 AM
Hi,
I've been having a discussion with work collegues about the best way to do something and we've come to a disagreement... so I thought I would see what you think.
Basically one side is saying that when creating their CSS its good to have lots of classes that can be used multiple times. E.g:
flLeft{
float: left;
}
flRight{
float: right;
}
topMargin10{
margin-top: 10px;
}
etc. Then it could be used like this:
<p class="flRight">Some text goes here</p>
OR
<p class="mainText flRight">Some text goes here</p>
The other side of people say that that is just adding unnecessary mark-up which would have to be changed if the site ever got re-designed and it would be much better to have it all in the element class itself. E.g.
p.mainText{
color: #000;
font-size: 1em;
float: right
}
I hope that makes sense. So what do you think, which way do you think is the best way to do it?
Thanks
Phil
I've been having a discussion with work collegues about the best way to do something and we've come to a disagreement... so I thought I would see what you think.
Basically one side is saying that when creating their CSS its good to have lots of classes that can be used multiple times. E.g:
flLeft{
float: left;
}
flRight{
float: right;
}
topMargin10{
margin-top: 10px;
}
etc. Then it could be used like this:
<p class="flRight">Some text goes here</p>
OR
<p class="mainText flRight">Some text goes here</p>
The other side of people say that that is just adding unnecessary mark-up which would have to be changed if the site ever got re-designed and it would be much better to have it all in the element class itself. E.g.
p.mainText{
color: #000;
font-size: 1em;
float: right
}
I hope that makes sense. So what do you think, which way do you think is the best way to do it?
Thanks
Phil