How to select classes with spaces

前端 未结 5 1406
星月不相逢
星月不相逢 2020-12-03 01:09

How do I select a class like class=\"boolean optional\" ?

I have tried this:

.boolean optional {CSS}

.boolean_optional {CSS}
         


        
5条回答
  •  天命终不由人
    2020-12-03 01:40

    I appreciate this was a while ago, but in case anyone's interested, something I've found handy also is, how to target/select an element within an element which has both classes... EXAMPLE

    .boolean.optional > p {
        color: red;
    }
    

    Perhaps requires no explanation, but: turns 'paragraph text red' ONLY for paragraph's inside of elements where both classes exist i.e.both .boolean AND .optional

提交回复
热议问题