html - 表行跨度单元格跨度

标签 html css html-table

这是一项我需要帮助的作业。我讨厌原样的表格,但这就是它所说的:

"The first row in each table consists of one table cell which spans two columns that contain the real estate listing name. The second row in each table consists of two table cells."

我的代码:

<table>
    <tr>
        <th>
            <h3>TEST</h3>
        </th>
    </tr>
    <th rowspan="2"></th>
    <td>Something here !</td>
</tr>
</table>

只是想验证我这样做是否正确?这是完整的代码:

http://jsfiddle.net/4jzUc/

此外,它应该看起来像这样:http://screencloud.net/v/aA5Y

最佳答案

你想要跨越列,而不是行(colspan vs rowspan)。我想这就是你要找的。

<table>
    <tr>
       <th colspan="2">
           Title
       </th>  
    </tr>
    <tr>
       <td>First cell</td>
    </tr>                       
    <tr>
       <td>Second cell</td>
    </tr>
</table>

关于html - 表行跨度单元格跨度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15824455/

相关文章:

javascript - 在 .append 之后运行函数

css - Rails - 如何将 css 添加到辅助方法

html - 列数为奇数的表中的偶数个 td 元素

html - 如何使图片在我放置代码的位置下方对齐?

javascript - CSS 样式 td 元素取决于 td 宽度

html - 我有六张图片和六段文字摘录,我希望每行两张图片,相关文字位于下方

html - 多种背景颜色相互重叠

javascript - 如何使用 grunt 更改我的 HTML 文件以引用缩小的 JS 和 CSS 而不是未压缩的文件?

html - 自动开始延迟加载图像,无需等待用户向下滚动页面

html - z-index 和伪类之后