Reputation: 2152
How many number of CSS classes can be assigned for an HTML element.
Upvotes: 10
Views: 4475
Reputation: 21
I'm pretty sure IE6 only supports up to 2. Modern browers have no limit as far as i know.
Upvotes: 2
Reputation: 176896
One of the lesser known tricks with CSS is the fact that you don't have to limit your elements to just one class. If you need to set multiple classes on an element, you add them simply by separating them with a space in your attribute. For example:
<p class="pullquote btmmargin left">...</p>
So there is no limit on no of classes you apply.
Upvotes: 1
Reputation: 74202
There are no such limitations imposed by the specification:
The attribute, if specified, must have a value that is a set of space-separated tokens representing the various classes that the element belongs to.
A set of space-separated tokens is a string containing zero or more words separated by one or more space characters, where words consist of any string of one or more characters, none of which are space characters.of which are space characters.
Upvotes: 4
Reputation: 284786
The standard does not specify any limitation, but individual browsers may have practical ones.
Upvotes: 7
Reputation: 1931
I don't think there's a limit. A quick Google search yielded this.
Upvotes: 10