输入的特异性[type =“text”]

时间:2013-03-29 19:34:53

标签: css css-selectors css-specificity

如何为以下内容添加特异性:

input[type="text"] { color:red }

我想要类似的东西:

#my_id input[type="text"] { color:red }

2 个答案:

答案 0 :(得分:4)

你的意思是这样吗?

input[type="text"]#my_id { color:red }

See the demo

答案 1 :(得分:1)

当您使用ID 并且不想寻址子节点时,您可以省略任何其他部分,ID必须是唯一的,到目前为止您只能使用:

#my_id { color:red }
相关问题