CSS selector with period in ID

前端 未结 3 1906
南方客
南方客 2020-11-28 06:37

The HTML spec allows for periods (.) in an id:

However, using a CSS ID selector rule will not match correc

3条回答
  •  甜味超标
    2020-11-28 07:07

    After digging through the specs some more, I found the CSS spec does allow for backslash (\) escaping like most languages.

    So in my example, the following rule would match:

    #some\.id {
      color: #f00;
    }
    

提交回复
热议问题