title: Should css class names like 'floatleft' that directly describe the attached style be avoided?
body: <p>Lots of websites use class names like <code>floatleft</code>, <code>clearfloat</code>, <code>alignright</code>, <code>small</code>, <code>center</code> etc that describe the style that is attached to the class. This seems to make sense so when writing new content you can easily wrap (for example) <code>&lt;div class="clearfloat"&gt;...&lt;/div&gt;</code> around your element to make it behave the way you want.</p>
  
  <p>My question is, doesn't this style of naming classes go against the idea of separating content from presentation? Putting <code>class="floatleft"</code> on an element is clearly putting presentation information into the HTML document.</p>
  
  <p>Should class names like this that directly describe the attached style be avoided, and if so what alternative is there?</p>
  
  <hr>
  
  <p>To clarify, this isn't just a question of what to name classes. For example a semantically accurate document might look something like:</p>
  
  <pre><code>&lt;div class="foo"&gt;Some info about foo&lt;/div&gt;
  ...
  &lt;div class="bar"&gt;Info about unrelated topic bar&lt;/div&gt;
  ...
  &lt;div class="foobar"&gt;Another unrelated topic&lt;/div&gt;
  </code></pre>
  
  <p>Say all these divs need to clear floats, the css would look something like:</p>
  
  <pre><code>div.foo, div.bar, div.foobar {
      clear:both;
  }
  </code></pre>
  
  <p>This starts to get ugly as the number of these clearing elements increases - whereas  a single <code>class="clearfloat"</code> would serve the same purpose. Is it recommended to group elements based on the attached styles to avoid repetition in the CSS, even if this means presentational information creeps into the HTML?</p>
  
  <hr>
  
  <p><strong>Update</strong>: Thanks for all the answers. The general consensus seems to be to avoid these class names in favour of semantic names, or at least use them sparingly provided they don't hinder maintenance. I think the important thing is that changes in the layout should not require excessive changes to the markup (although a few people said minor changes are okay if it makes overall maintenance easier). Thanks to those who suggested other methods to keep CSS code smaller as well.</p>