设置input框文字垂直居中和宽度

时间:2022-11-03 00:07:59
input {
solid #999;height:22px;
background:#ffffff;
line-height:22px;
margin:0px; padding:0px;/*表单输入框内文字居中*/
vertical-align:middle;/*表单控件上下居中对齐*/}

设置input的宽度和高度

.input{ width:300px; height:18px; }

在input中调用该class,这个设置统一的宽度可以解决type=text和type=password长度不同的问题

<input class="input" type="text" name="gsmc" value='<%=gsmc%>' disabled="disabled"/>

其中disabled属性是设置该input为不可编辑

设置input无边框并且不可编辑

 style="readonly:expression(this.readOnly=true);border:0px"