input[type="text"],
input[type="password"] {
border: 1px solid #ccc;
padding: 2px;
font-size: 1.2em;
color: #444;
width: 200px;
}
input[type="password"] {
border: 1px solid #ccc;
padding: 2px;
font-size: 1.2em;
color: #444;
width: 200px;
}
第一种: .style1{color:red;} .style2{color:green;} <input type="text" class="style1" /> <input type="password" class="style2" /> 第二种: <input type="text" style="color:red;" /> <input type="password" style="color:green;" /> 第三种:css3选择器,ie低版本不支持 input[type=text]{color:red;} input[type=password]{color:green;} <input type="text" /> <input type="password" /> 当然还可以根据js去做 来自 http://zhidao.baidu.com/link?url=oLeW-lPrJGaTQAULZf8eIDOjY4o8uZx99Z7a0B5lZuELE3SGM5Q5EGq-n1ao4Sp1CmgiuOqxAGDODVgUyq3_yM8ezzjV6RUMia8f0RxQ313
在css只指定<input type="text">的控件,排除<input type="submit">等.用 input {border:1px solid #ddd;}的方式会改所有type的input控件.
排除IE6 用css过滤 input[type=="text"]{ border:1px solid #ddd; } 这个排除IE6是啥意思啊,是IE6以上的版本才支持吗?? 呵呵,搜到了一种做法: <style> input{background-color:expression(this.type=="text"?'#ffffff':'#ccccff') } </style>