Categories
Software Engineering Web Development

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 replies on “Multiple CSS Classes”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.