我只想更改其宽度:

     <input type="text" name="experience"/>


但是我有这个:

<input type="checkbox" name="option2" value="2222" />


也改变..当我设置:

input {width:134px;}

最佳答案

给它一个classid并使用一个类或id选择器:

<input type="text" name="experience" id="experience" />
<input type="text" name="experience" class="experience" />

#experience { width:134px }
.experience { width:134px }


另外,您可以使用attribute selector

input[name='experience'] { width:134px }


但是请注意,属性选择器在IE6中不起作用,因此,如果要支持它,则必须使用类或id选择器。

关于html - 如何设置文本框的样式(html),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7635050/

10-13 06:03