gpt4 book ai didi

html - 使用分组的 div 获取表结构

转载 作者:太空宇宙 更新时间:2023-11-04 02:14:04 24 4
gpt4 key购买 nike

我想要一个分组的表格数据。想要所有宽度相等的单元格。请引用下面的代码。

  .details {
display: table;
width: 100%;
}
.row {
display: table-row;
}
.cell1, .cell2, .cell3 {
width: 100%;
display: table-cell;
border: 1px solid gray;

}
.groups {
border: 1px solid red;
}

.group-name {
font-weight: bold;
}

    <div class="details">
<div class="groups">
<div class="group-name">
one
</div>
<div class="list">
<div class="row">
<div class="cell1">
cell1
</div>
<div class="cell2">
cell2
</div>
<div class="cell3">
cell3
</div>
</div>
<div class="row">
<div class="cell1">
cell1
</div>
<div class="cell2">
cell2
</div>
<div class="cell3">
cell3
</div>
</div>
</div>
</div>
<div class="groups">
<div class="group-name">
two
</div>
<div class="list">
<div class="row">
<div class="cell1">
cell1
</div>
<div class="cell2">
cell2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="cell3">
cell3
</div>
</div>
<div class="row">
<div class="cell1">
cell1
</div>
<div class="cell2">
cell2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="cell3">
cell3 some big Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
</div>
</div>
</div>

最佳答案

添加 flex 以获得相同的大小。

 .details {
display: table;
width: 100%;
}
.row {
display: table-row;
display:flex;
}
.cell1{
width: 30%;
display: table-cell;
border: 1px solid gray;
flex: 1;

padding: 1em;


}
.cell2 {
width: 30%;
display: table-cell;
border: 1px solid gray;
flex: 1;

padding: 1em;


}
.cell3 {
width: 30%;
display: table-cell;
border: 1px solid gray;
flex: 1;
padding: 1em;


}
.groups {
border: 1px solid red;
}

.group-name {
font-weight: bold;
}
<div class="details">
<div class="groups">
<div class="group-name">
one
</div>
<div class="list">
<div class="row">
<div class="cell1">
cell1
</div>
<div class="cell2">
cell2
</div>
<div class="cell3">
cell3
</div>
</div>
<div class="row">
<div class="cell1">
cell1
</div>
<div class="cell2">
cell2
</div>
<div class="cell3">
cell3
</div>
</div>
</div>
</div>
<div class="groups">
<div class="group-name">
two
</div>
<div class="list">
<div class="row">
<div class="cell1">
cell1
</div>
<div class="cell2">
cell2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="cell3">
cell3
</div>
</div>
<div class="row">
<div class="cell1">
cell1
</div>
<div class="cell2">
cell2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="cell3">
cell3 some big Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
</div>
</div>
</div>

关于html - 使用分组的 div 获取表结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39202299/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com