html - 在html中制作自定义表格

标签 html css html-table

是否可以像这样用 HTML 和 CSS 制作表格?

https://imgur.com/3NmbYnE

我想要一个全高的列(在右边),其余的是图片上的行。

最佳答案

您可以使用网格轻松实现此目的:

.thead {
    padding: 5px;
    grid-area: thead;
    border: 3px solid gray;
}

.col {
    grid-area: col;
    border: 3px solid red;
}

.r {
    border: 3px solid green;
    padding: 5px;
}
.row-1 {
    grid-area: row-1;
}
.row-2 {
    grid-area: row-2;
}
.row-3 {
    grid-area: row-3;
}
.row-4 {
    grid-area: row-4;
}
.row-5 {
    grid-area: row-5;
}

.container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-areas:
    "thead thead"
    "row-1 col"
    "row-2 col"
    "row-3 col"
    "row-4 col"
    "row-5 col";
}
<div class="container">
        <div class="thead">thead</div>
        <div class="col">Col</div>
        <div class="r row-1">Row 1</div>
        <div class="r row-2">Row 2</div>
        <div class="r row-3">Row 3</div>
        <div class="r row-4">Row 4</div>
        <div class="r row-5">Row 5</div>
 </div>
 
 

Grid-template-areas确实值得研究。

关于html - 在html中制作自定义表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46824309/

相关文章:

html - 如何实现弧形顶部指针

jquery - 如何在owl-carousel中在移动设备上显示单个图像?

html - 如何调整html表格中固定行的宽度

javascript - 向上滚动文本并在使用 html5 音频读取文本时将其隐藏

html - 如何使 span 标签以其当前元素为中心(如 Youtube 分享按钮)

html - CSS/样式中的下拉菜单

css - 如何在网格中的 bootstrap 4 中使用粘性顶部类

html - 如何制作响应式缩略图?

html - 应用于 tr 的渐变在每个 td 处分别呈现。如何在 tr 上创建水平渐变?

jQuery 隐藏表格单元格中的子字符串