Just like the title, I can't set the td
width
in specific environment like this and you can look the demo here http://codepen.io/quietcoder/pen/ygRVLB?editors=1100
.outer {
position: relative;
display: inline-block;
}
.inner {
position: absolute;
}
<div class="outer">
<div class="inner">
<table>
<tr>
<td style="width: 100px">
<div>123</div>
</td>
<td>
<div>123</div>
</td>
</tr>
</table>
</div>
</div>
Then, If I write two table, the width in td
will work, it's so amaaaaaaaazing!!!
And do you knew why this happened?
.outer {
position: relative;
display: inline-block;
}
.inner {
position: absolute;
white-space: nowrap;
}
.inline-block-box {
display: inline-block;
}
<div class="outer">
<div class="inner">
<div class="inline-block-box">
<table>
<tr>
<td style="width: 100px">
<div>123</div>
</td>
<td>
<div>123</div>
</td>
</tr>
</table>
</div>
<div class="inline-block-box">
<table>
<tr>
<td style="width: 100px">
<div>123</div>
</td>
<td>
<div>123</div>
</td>
</tr>
</table>
</div>
</div>
</div>
If you check the div.inner
width property in devtool, you can find that the width is very interesting......
Can you explain it?