Multiple CSS Classes

I’m not sure I should really admit to not knowing this… but today was the first time I’d realised that the “class” attribute for elements within a HTML document can accept more than one class name. doh.

Update: Here’s a simple example. With the following in your style sheet…

.align-c { text-align: center; }
.font-b { font-weight: bold; }

You can have something like <div class=”align-c font-b”></div> to make the contents of the div tag bold and centre-aligned.

6 thoughts on “Multiple CSS Classes”

Leave a Reply

Your email address will not be published. Required fields are marked *