html - colspan 不接受十进制数。如何指定跨度?

标签 html css html-table

<table>
    <thead>
        <th colspan="4">Liquor Store Blues</th>
    </thead>
    <tbody>
        <tr>
            <td colspan="4">Meow</td>
        </tr>
        <tr>
            <td colspan="2">Meow</td>
            <td colspan="2">Meow</td>
        </tr>
        <tr>
            <td colspan="1.33">Meow</td>
            <td colspan="1.33">Meow</td>
            <td colspan="1.33">Meow</td>
        </tr>
        <tr>
            <td>Meow</td>
            <td>Meow</td>
            <td>Meow</td>
            <td>Meow</td>
        </tr>
    </tbody>
</table>

我在这里有一张它的图片:http://i.imgur.com/myKN33l.png

想将第 4 行中每个 tdcolspan 设置为 1.44 但后来我知道 colspan 不接受十进制数。那我该怎么做呢?我应该使用 CSS 吗?如果是这样,如何?

最佳答案

因为您的第 4 行有 3 个元素,所以您的表格实际上有 12 列,而不是 4 列。

http://cssdeck.com/labs/9lzcwolh

td {
  border: 1px solid;
}
<table>
    <thead>
        <th colspan="12">Liquor Store Blues</th>
    </thead>
    <tbody>
        <tr><td colspan="12">A1</td> </tr>
      
        <tr><td colspan="6">B1</td><td colspan="6">B2</td></tr>
      
        <tr><td colspan="4">C1</td><td colspan="4">C2</td><td colspan="4">C3</td></tr>
      
        <tr><td colspan="3">D1</td> <td colspan="3">D2</td> <td colspan="3">D3</td><td colspan="3">D4</td></tr>
    </tbody>
</table>

关于html - colspan 不接受十进制数。如何指定跨度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16795358/

相关文章:

javascript 将元素附加到 div 中

html - 响应式网站问题开放空间

javascript - 自动调整网页上图像的大小

css - 背景图像 Bootstrap 无全屏

css - Android 设备的媒体查询

java - Wicket:用自定义内容动态填充单元格

html - 防止文本重叠表格 td 宽度

html - observe.js 中的纸张下拉菜单错误

html - <select> 标签上的不同浏览器行为

html - 在表格的列中拟合图像