我在表格單元格的內部顯示了css值爲display:none的div。當我$ .show()它時,單元格稍微向右擴展。當我使用visible屬性而不是display:none時,這工作正常,但如果不需要,我不想保留高度。我嘗試了各種顯示屬性以及重新排列CSS寬度,邊距和填充以及刪除背景圖像。在調整大小的表格單元格內顯示div
<div id='1'>
<table>
<tr>
<td>
<div class='container'>
<div class='error'>I am some long ass error that breaks my layout and I can't figure out what to do.</div>
<div>header</div>
<div>
<input type='button' value='add to cart'/>
</div>
</div>
</td>
<td>
<div class='container'>
<div class='error'>I am some long ass error that breaks my layout and I can't figure out what to do.</div>
<div>header</div>
<div>
<input type='button' value='add to cart'/>
</div>
</div>
</td>
<td>
<div class='container'>
<div class='error'>I am some long ass error that breaks my layout and I can't figure out what to do.</div>
<div>header</div>
<div>
<input type='button' value='add to cart'/>
</div>
</div>
</td>
</tr>
</table>
</div>
#1{width:400px;}
table {width:100%;}
tr {border: solid grey;}
.container{
border-right: 1px dotted #A5A5A5;
margin: 25px 0;
}
div {
display:block;
margin:auto;
text-align:center;
}
.error {
display:none;
padding-left:20px;
width:80px;
table-layout:fixed;
}
這裏是一個fiddle showing the problem
好,我會張貼在元j08691但較少人會出現查看,因此沒有真正改變使用的jsfiddle當具有格式化代碼的需求壓力較小。一個非常繁重的設計... –
我沒有看到問題 – Rodolfo
我的不好,我沒有更新小提琴,現在嘗試鏈接。問題是,列更改大小 –