0

Is there a way in CSS to select based on the existence of a class declaration, but not it's actual name? I want to say something like, for all body with id=declaration and any class, display: block.

4

1 に答える 1

3

Yes, you can use an attribute selector to test for the existence of a class attribute:

body#declaration[class] {
    display: block;
}
于 2012-08-04T23:38:53.940 に答える