What does a space mean in a CSS selector? i.e. What is the difference between .classA.classB and .classA .classB?

.classA.classB refers to an element that has both classes A and B (class="classA classB"); whereas .classA .classB refers to an element with class="classB" descended from an element with class="classA".

Edit: Spec for reference: Attribute Selectors (See section 5.8.3 Class Selectors)

Leave a Comment