时间:2021-07-01 10:21:17 帮助过:67人阅读
解析现象:
input:text特性时,
默认情况下:
1.firefox高度height为16px;IE下高度为14px;
2.字体大小为:13.3333px;
3.input存在padding值:Firefox为:padding:1px 0;IE下为:padding:1px 0 3px 0;
解决实例:如下代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
body {
font-family:"宋体";
font-size:12px;
}
table {
border-collapse:collapse;
border:solid red 1px;
}
td,th {
border:solid red 1px;
height:40px;
}
label {
vertical-align:middle;
}
.inputtxt {
width:200px;
padding:0;
font-family:"宋体";
font-size:12px;
height:15px;
line-height:15px;
vertical-align:middle;
border:solid #0000FF 1px;
}
</style>
</head>
<body>
<form action="#" method="post">
<table>
<tr>
<th width="44">firt</th>
<td ><input name="aj" type="text" maxlength="6" class="inputtxt" />
<label>知</label>
<input type="text" maxlength="6" class="inputtxt" /></td>
</tr>
<tr>
<th>second</th>
<td>
<input name="bs" type="text" maxlength="6" class="inputtxt" /></td>
</tr>
</table>
</form>
</body>
</html>
这种情况下IE和firefox都一样了如下图: