A question about CSS selectors

A question about CSS selectors

by Samuli Karevaara -
Number of replies: 3
If there is an HTML element like <div class="left side">, is there a way to target this by specifying "elements that are both of the class 'left' and 'side' "? I couldn't find a way from the W3 specs... (Now doing the obvious: styling .left and .side separately)
Average of ratings: -
In reply to Samuli Karevaara

Re: A question about CSS selectors

by Urs Hunkler -
Picture of Core developers

Samuli, if you want to adress elements only when both classes are attached you use .left.side without a space between the class names.

Please read further explanations at CSS 2.1 - 5.8.3 Class selectors.

Urs

In reply to Urs Hunkler

Re: A question about CSS selectors

by Samuli Karevaara -
Thank you very many! smile

Slightly embarrasing to have missed that bit in the specs, I thought I had read the "selectors" part carefully...