欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

如何给 input 中 type="text" 设置css input type text


 
input[type="text"], 
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">的控件

在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>
kuui_chiu | 浏览 6011 次  2009-05-12 11:16
 
排除IE6
用css过滤

input[type=="text"]{
 border:1px solid #ddd;
}

恩,这个css只有IE6以上版本才支持

否则,你只有在type==text的input加上特定的class了

来自 http://zhidao.baidu.com/link?url=Dxolk1wR8w3nzwBDju9GMAFH_hGuE638zs0NgxLkOYFIbdzdMz4vKK3hzCAsFZIJsw0CEO98unuweZwaawEIQa
 

普通分类: