Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I apply more than one CSS3 class to an element? [closed]

Tags:

html

css

I'm reading different opinions on this. Is this allowed in CSS HTML5:

<div class="one-class another-class">...

to apply the properties of both one-class and another-class to the element?



Re the downvote: yes, I tried it, and it does work. But that doesn't mean it's good practice. It could be deprecated for instance.

like image 430
Geert Goeteyn Avatar asked Oct 25 '13 12:10

Geert Goeteyn


1 Answers

Yes, that is allowed.

The class attribute according to the HTML specification:

"This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters."

http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.2

like image 159
Guffa Avatar answered Sep 24 '22 15:09

Guffa