【发布时间】:2013-03-20 13:37:42
【问题描述】:
如何为以下内容添加特异性:
input[type="text"] { color:red }
我想要类似的东西:
#my_id input[type="text"] { color:red }
【问题讨论】:
-
HTML 是什么样的?
标签: css css-selectors css-specificity
如何为以下内容添加特异性:
input[type="text"] { color:red }
我想要类似的东西:
#my_id input[type="text"] { color:red }
【问题讨论】:
标签: css css-selectors css-specificity
【讨论】:
当您使用 id 并且不想处理子节点时,您可以省略任何其他部分,id 必须是唯一的,因此您只能使用:
#my_id { color:red }
【讨论】: