简体   繁体   English

HTML表格td宽度与colspan相同

[英]HTML table td width different with same colspan

below is my experimental code, 下面是我的实验代码,

I'm now confusing why the two cells at first row have different width when I was trying to inspect them. 我现在很困惑为什么当我试图检查它们时,第一排的两个单元格具有不同的宽度。

https://jsfiddle.net/rbx1219/43j6obxt/3/ https://jsfiddle.net/rbx1219/43j6obxt/3/

<tr>
    <td colspan="2" rowspan="2">
        <div class='big'>

        </div>
    </td>
    <td colspan="2" rowspan="2">
        <div class='big'>

        </div>
    </td>
</tr>

td width unexpected td宽度意外

You can use display: inline-block; 你可以使用display: inline-block; to prevent the element from filling the width. 防止元素填充宽度。

Read more https://developer.mozilla.org/en-US/docs/Web/CSS/display?v=control 阅读更多https://developer.mozilla.org/en-US/docs/Web/CSS/display?v=control

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM