How to select classes with spaces

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

    Classes will never actually have spaces in their name. In your example, that is actually two classes; boolean and optional.

    to apply style to an element that has both of those classes, the construct is

    .boolean.optional {
     /* CSS */
    }
    

    However, IE6 is known to have some issues with this. See this link for more details on known quirks.

提交回复
热议问题