tags:

views:

117

answers:

4

How many number of CSS classes can be assigned for an HTML element.

+1  A: 

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.

Pranay Rana
I think he realizes the answer is > 1, or he wouldn't be asking the question...
Mark
totally missing the point of the question
camilin87
yes so the ans is there is no limit on no of classes you apply on one element
Pranay Rana
he is not asking for a theoretical answer
Shree
+9  A: 

I don't think there's a limit. A quick Google search yielded this.

kitsched
Good find. For those who don't want to click the link, the answer is "over 2000"
Mark
+4  A: 

The standard does not specify any limitation, but individual browsers may have practical ones.

Matthew Flaschen
+1 for referencing the spec
David Johnstone
+2  A: 

There are no such limitations imposed by the specification:

class

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.

Alan Haggai Alavi