css tips and tricksUsing Two Classes on one item in CSS.

Here's a quick CSS Tip you can use if you need to style an item with two(or more) classes.

Sometime you might need to make something stand out a little more than the rest of the elements using the same CSS Class. You could throw a span tag around it or you can uses a second CSS Class. This way if you need to use this style again you aren't constantly having to type out the whole span tag.

It's actually pretty simple…
The HTML

<div class="one two">This text has TWO classes.</div>

The CSS
.one
{
color: #ff0000;
}
.two
{
font-size: 1.5em;
}

and here is the result:

This text has TWO classes.

A simple but very useful CSS Tip.

Popularity: 15% [?]