:empty selector not working in css

后端 未结 2 1230
故里飘歌
故里飘歌 2020-12-29 06:37

i used :empty selector in .error class. the problem is that even when there is no content inside the div with class of error, the error class is n

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-29 06:55

    The :empty pseudo-class doesn't select elements, containing elements or text (and white space is text).

    However, there is now the experimental :blank pseudo-class which selects elements, containing nothing or just white space, and .error:blank would select that

    element. You should avoid using experimental features in your production code, though.

提交回复
热议问题