日期:2014-05-17  浏览次数:20586 次

input关于type=text的css问题.等了!!!
在CSS里能不能只控制input里的text的样式?

看了之前一贴,实现方法如下:
<INPUT   TYPE= "text "   NAME= " "   value= "text ">

<style>
INPUT.text
{
height:19px;
padding:2px   2px   2px;
}
</style>

<script>      
    var       a       =       document.getElementsByTagName( "INPUT ");      
    for(var       i=0;       i <a.length;       i++){
if(a[i].type== "text "){
a[i].className= "text ";      
}
    }
</script>    

除以上这方法外是否还有其实只需要在样式表里就能控制的?

------解决方案--------------------
<style>
INPUT
{
color:red
}
</style>
------解决方案--------------------
input[type=text] {border:1px solid #000000}
------解决方案--------------------
lkh42002(HAI) 写的
input[type=text] {border:1px solid #000000}
在FF中可以显示出效果呀,但在ie中不能显示,为什么呀?

------解决方案--------------------
input[type=text], input[type=password] {
padding:2px;
border:1px solid #ccc;
}

input {
padding:expression(type == "text " || type == "password " ? "2px " : "normal ");
border:expression(type == "text " || type == "password " ? "#ccc solid 1px " : "normal ");
}

select {
padding:1px;
border:1px solid #ccc;
}

textarea {
border:1px solid #ccc;
padding:2px;
}

------解决方案--------------------
<style>
INPUT#x{background:#369;color:ff4}
INPUT#x1{background:red;color:fff}
#v1 input#x2{background:yellow;color:000}
</style>
<div id= 'v1 '>
<input id= "x " type= 'text ' value= 'xxx '>
<input id= "x1 " type= 'text ' value= 'xxx '>
<input id= "x2 " type= 'text ' value= 'xxx '>
</div>
类选择器上面有了就不举例了