Let's say I have cleaner like this
.cleaner:after {
content: '.';
display: block;
clear: both;
visibility: hidden;
height: 0;
}
so I can add class cleaner to everything I want to clear floats. This is imho much better way than adding
<div style="clear:both;"></div>
instead, because it doesn't really separate design from markup.
But while this approach can reduce some code duplicates, it also kinda breaks the idea of separated design, because I have to change html directly.
Is it ok to have classes like this and add them wherever needed? Or should I add the :after { ...
explicitely to everything I wan't to clear floats (like #header:after ..., #menu:after { ....`) which results in code duplicites, but also much more separated design where I don't have to touch the HTML directly.
Probably the general purpose class would be useful for javascript, where it would be easier to change styles, but are the code duplicates worth the effect of separated design in pure HTML/CSS?