不能在CSS中使用逗号组合选择器 [英] Can't combine selectors using commas in CSS
问题描述
HTML5占位符总是比输入中心稍高,因此我尝试使用 :: - webkit-input-placeholder
一点点。由于某些原因,我不能组合选择器。这里是一个小提琴演示这个: http://jsfiddle.net/n7VV7/
HTML5 placeholders always appear slightly higher than the center of the input, so I'm trying to use CSS like ::-webkit-input-placeholder
to push them down a bit. For some reason, I can't combine the selectors. Here's a Fiddle demonstrating this: http://jsfiddle.net/n7VV7/
我不想分开他们,因为我使用一个自动组合线的CSS压缩工具。现在,我可以手动分离它们,但在将来,我会忘记我不能合并这些行。
I don't want to separate them because I use a CSS compression tool that automatically combines lines. Right now, I can manually separate them, but in the future, I will forget that I can't combine these lines.
推荐答案
不能使用逗号来组合供应商加前缀的选择器,因为当浏览器遇到一个不能理解的选择器时,该行被抛出。这就是为什么必须分割任何选择器的供应商前缀,而不仅仅是 ::
伪类。
You can't use commas to combine vendor-prefixed selectors because when a browser encounters a selector it does not understand, that line is "thrown out." This is why it's necessary to break up vendor prefixes for any selector, not just the ::
pseudo-classes.
以下链接指向 CSS-Tricks 对问题进行评论。
Here's a link to a CSS-Tricks comment on the problem.
这篇关于不能在CSS中使用逗号组合选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!