Why can I not group browser-specific CSS-selectors for different browsers?

前端 未结 3 753
庸人自扰
庸人自扰 2021-01-12 22:11

I just tried to write the following rule to style the input placeholder for browsers that support it:

#main input::         


        
3条回答
  •  长情又很酷
    2021-01-12 22:17

    If one selector in a group of selectors is invalid, the browser must treat the entire rule as invalid. Or at least so says the W3C.

    I'm not sure why this behaviour is mandated, but at a push, I'd guess it's because an invalid selector could break general CSS syntax, making it impossible for a browser to reliably guess where the invalid selector ends and valid elements begin.

提交回复
热议问题