...row,table-cell,如何实现像html table的colspan合并单元格效果...
发布网友
发布时间:2022-04-23 09:39
我来回答
共3个回答
热心网友
时间:2022-04-21 12:08
display的table属性我也不太了解。可以用 display:table-caption;来代替一列吗?
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>display:table</title>
<style type="text/css">
* { margin:0; border:0; padding:0;}
.table { display:table; background:#f00;width:500px;margin-left:200px; }
.t_row { display:table-caption; border:1px solid #f00; height:100px; background:#00f;}
.t_cell { display:table-cell; border:1px solid #f00; height:100px; background:#0f0 }
</style>
</head>
<body>
<div class="table">
<div class="t_row">一列</div>
<div class="t_cell">两列</div>
<div class="t_cell">两列</div>
</div>
<div class="table">
<div class="t_row">一列</div>
<div class="t_cell">三列</div>
<div class="t_cell">三列</div>
<div class="t_cell">三列</div>
</div>
<div class="table">
<div class="t_row">一列</div>
<div class="t_cell">四列</div>
<div class="t_cell">四列</div>
<div class="t_cell">四列</div>
<div class="t_cell">四列</div>
</div>
</body>
</html>
用这种写法试试呢?
热心网友
时间:2022-04-21 13:43
用JQ吧,
attr('colspan','5')
热心网友
时间:2022-04-21 15:34
display: table-column-group