html - 如何制作一个表的第一行比其他行更多的列?

标签 html css tablelayout

我正在尝试用 HTML 构建一个简单的表格,但遇到了一个我无法解决的问题。我的表目前看起来像这样:

My current table

如何让它看起来像这样?

Table layout that I want to achieve

第二行的单元格从顶部单元格的一半开始。

最佳答案

你可以试试 flexbox:

https://jsfiddle.net/87swa6mm/1/

<style>
.box {
   background-color: #eee;
   padding: 10px;
   margin: 10px;
}
.flex-c {
  display: flex;
  justify-content: center;
}
</style>


<div class="flex-c">
<div class="box">foo</div>
<div class="box">foo</div>
<div class="box">foo</div>
<div class="box">foo</div>
</div>

<div class="flex-c">
<div class="box">foo</div>
<div class="box">foo</div>
<div class="box">foo</div>
</div>

<div class="flex-c">
<div class="box">foo</div>
<div class="box">foo</div>
<div class="box">foo</div>
</div>

关于html - 如何制作一个表的第一行比其他行更多的列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41814233/

相关文章:

Android TableRow RelativeLayout 问题

javascript - 获取 HTML 并插入到 DOM 中,但相对于特定路径进行解析

jquery - 显示无在 jQuery 按钮单击中添加新行

html - 将 svg 嵌入到 html 中的可重用性

html - 如何从上下文菜单中删除默认菜单上下文

android - 在 TableLayout 中对齐列

html - 你能为图像设置背景图像吗?

javascript - 如何快速加载多个图像(没有 Css Sprites)

html - 如何在响应式设计中包含图像和文本部分?

css - 表格布局 :fixed not expanding table-cells inside absolute 100% width table-row (elements not collapsing either)