小程序简单实现表格布局

wxml部分

省份/直辖市
GDP
增长率
广东
72812456
8.0%
河南
37010
8.3%
江苏
70116
8.5%

wxss部分

.table, .table div {
margin: 0 auto;
}

.table {
display: table;
width: 100%;
border-collapse: collapse; //合并边框
box-sizing: border-box;
}

.table-tr {
display: table-row; //此元素会作为一个表格行显示(类似 )
height: 92rpx;
}

.table-th {
display: table-cell; //此元素会作为一个表格单元格显示(类似 和 )
font-weight: bold;
border: 1rpx solid gray;
text-align: center;
vertical-align: middle;
}

.table-td {
display: table-cell;
border: 1rpx solid gray;
text-align: center;
vertical-align: middle;
}

效果图



转载于:https://juejin.im/post/5ca702816fb9a05e4f0588a9

你可能感兴趣的:(小程序简单实现表格布局)