CSS selector for text input fields?

后端 未结 9 779
广开言路
广开言路 2020-12-07 07:46

How can I target input fields of type \'text\' using CSS selectors?

9条回答
  •  时光说笑
    2020-12-07 07:58

    As @Amir posted above, the best way nowadays – cross-browser and leaving behind IE6 – is to use

    [type=text] {}
    

    Nobody mentioned lower CSS specificity (why is that important?) so far, [type=text] features 0,0,1,0 instead of 0,0,1,1 with input[type=text].

    Performance-wise there's no negative impact at all any more.

    normalize v4.0.0 just released with lowered selector specificity.

提交回复
热议问题