Using multiple CSS styles on a single element
November 5th, 2007 by Dustin Brewer
I have been asked questions recently about using different sets of styles on elements and thought I would briefly touch on the subject to explain a little further. Have you ever wanted to use styleA and styleB on the same div? Well with classes you can, you can easily specify multiple classes on what div or any element that you want without any trouble at all.This isn’t explicitly stated in some help sites and can be easily overlooked because it is not often that you can do this kind of thing within HTML and CSS. You will see below what I mean if it is still unclear what I am talking about.
<div class="styleA styleB">
</div>
Nothing particularly fancy but can come in very handy if you have several different objects that are only styled slightly different but you want to write less CSS. You can use as many classes on any type of element as you need. There isn’t a limitation of any kind on such things.
Popularity: 3%








November 5th, 2007
whew awesome- additional information again. great job. Thanks
November 5th, 2007
Nice, easy CSS article. Love the site!
November 5th, 2007
I don’t think you mentioned that you can also apply an id to those elements as well as multiple CSS classes.
November 5th, 2007
Great css 101 article, definitely something for beginners to be aware of— it can save a ton of time!