全宽所以,我有一个表:HTML表保证金
<table border=1>
<caption>This is a table.</caption>
<tr>
<th>One</th>
<th>Two</th>
<th>Three</th>
</tr>
<tr>
<td>Four</td>
<td>Five</td>
<td>Six</td>
</tr>
</table>
,我希望它是尽可能宽,同时仍然留在每边20像素的保证金。所以,我这样做:
table{
border-collapse:collapse;
margin:20px;
padding:0;
width:100%;
}
,但它最终被父的宽度,再加上左侧有一个额外20px的保证金,造成垂直滚动条出现。有没有办法使它的40px比父宽度小,而不需要添加其他元素来包围它呢?
的jsfiddle:http://jsfiddle.net/pvHNM/
的[股利宽度的像素的100%减去固定量]可能重复(http://stackoverflow.com/questions/651317/div-width-100-minus-fixed-amount-of-pixels) – Gajus 2014-04-06 13:15:26