我可以区分不同输入类型的CSS吗?

Maw*_*awg 6 css

input type = text/radio/checkbox - 我可以在CSS中区别对待它们吗?

除了添加class=我的意思

Kyl*_*yle 14

是!

有一个叫做属性选择器的很棒的东西:

input[type="text"] { width: 200px; }
Run Code Online (Sandbox Code Playgroud)

只需改变它text,你就会好起来!

但请注意,这些在IE6上不起作用,所以你可能想看一下dean.edwards.name IE7.js :)


小智 5

您可以像这样使用属性选择器

input[type=text] { ... }
Run Code Online (Sandbox Code Playgroud)

但是,并非所有浏览器都支持此功能.你最安全的选择是上课