Follow by Email

Monday, 28 January 2013

Use Multiple CSS Classes on a Single Element

One of the lesser known tricks with CSS is the fact that you don't have to limit your elements to just one class. If you need to set multiple classes on an element, you add them simply by separating them with a space in your attribute. For example:
<p class="pullquote btmmargin left">...</p>
This sets the following three classes on that paragraph tag:
  • pullquote
  • btmmargin
  • left
You would assign these as generic classes in your CSS:
.pullquote { ... }
 .btmmargin { ... }
 p.left { ... }


Post a Comment

Design by Abhinav Ranjan Sinha