两个并列的表格结构一样,但是却对不齐?
input标签在td里面是不是也会影响宽度?
希望能得到导致的原因和解决办法!
代码如下:
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>test</title>
<style type="text/css">
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, form, fieldset, legend, input,
textarea, p, blockquote, th, td,tr,thead,tbody,table{margin: 0; padding: 0;}
table tr td{ text-align:center;}
td.wholesale{width:42px;}
td.videoCoding{width:50px;}
td.voice{width:88px;}
td.sales{width:44px;}
td.skuRelated{width:140px;}
td.lastReportedTime input{display:block;width:100px;}
td.lastReportedTime{width:100px;}
td.finalQuantity{width:50px;}
td.finalQuantity input{display:block;width:50px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="1" rules="all" border="1" style="WIDTH:100%; WORD-BREAK: break-all; BORDER-COLLAPSE: collapse;">
<thead>
<tr>
<td class="lastReportedTime">
最后报量时间
</td>
<td class="finalQuantity">
最后报量数量
</td>
<td class="voice">
声道
</td>
<td class="sales">
销售总数
</td>
<td class="videoCoding">
视频编码
</td>
<td class="wholesale">
批发价
</td>
<td class="skuRelated">
相关SKU <font style="font-size:4px">(非实时)</font>
</td>
</tr>
</thead>
</table>
<table cellspacing="0" cellpadding="1" rules="all" border="1" id="DataGrid1" style="WIDTH:100%; WORD-BREAK: break-all; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
<thead>
<tr>
<td class="lastReportedTime">
最后报量时间
</td>
<td class="finalQuantity">
最后报量数量
</td>
<td class="voice">
声道
</td>
<td class="sales">
销售总数
</td>
<td class="videoCoding">
视频编码
</td>
<td class="wholesale">
批发价
</td>
<td class="skuRelated">
相关SKU <font style="font-size:4px">(非实时)</font>
</td>
</tr>
</thead>
<tbody>
<tr>
<td class="lastReportedTime">
<input value="我需要这样的input">
</td>
<td class="wholesale">
input不要去掉
</td>
<td class="voice">
</td>
<td class="finalQuantity">
就算是把input去掉也对不齐
</td>
<td class="videoCoding">
希望能知道是什么原因
</td>
<td class="sales">
谢谢了!
</td>
<td class="skuRelated">
</td>
</tr>
</tbody>
</table>
</body>
</html>
郁闷,你这个问题,我看了一个小时,简直很低级的错误!!!看我这么辛苦给你解决,给我个采纳把。
错误没有什么高深的,是你代码写错了。不信?
上面两个
class
改好,你发现还是有点对不齐?