How to select classes with spaces

前端 未结 5 1413
星月不相逢
星月不相逢 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:37

    Spaces are not valid in class name. class="boolean optional" means the element has the classes boolean and optional, so you can match it with either .boolean, .optional, or if you want to match only objects that are both optional and boolean, with .boolean.optional.

提交回复
热议问题