uniapp-css-table

最近在使用uniapp写表格,记录一下

表格table
display:table;
行tr
display:table-row;
单元格
display:table-cell;
居中
vertical-align: middle;
text-align: center;
标题
display: table-caption;

基础使用

<template>
<view class="table">
	<view class="t-title">基础使用</view>
    <view class="tr">
        <view class="th">姓名</view>
        <view class="th">年龄</view>
        <view class="th">班级</view>
    </view>
    <view class="tr">
        <view class="td">齐安</view>
        <view class="td">18</view>
        <view class="td">16102</view>
    </view>
    <view class="tr">
        <view class="td">齐安</view>
        <view class="td">18</view>
        <view class="td">16102</view>
    </view>
    <view class="tr">
        <view class="td">齐安</view>
        <view class="td">18</view>
        <view class="td">16102</view>
    </view>
</view>
</template>

<style lang="scss" scoped>
.table {
	display: table;
	width: 300px;
	border-collapse: collapse;
	margin-bottom: 100px;
}

.t-title {
	display: table-caption;
	vertical-align: middle;
	text-align: center;
}

.th {
	display: table-cell;
	font-weight: bold;
	height: 100%;
	text-align: center;
	vertical-align: middle;
	background-color: #e6d2d5;
}
.tr {
	display: table-row;
}
.td {
	display: table-cell;
	height: 100%;
	// width: 100%;
	text-align: center;
	vertical-align: middle;
}

.sub-table {
	width: 100%;
	// height: 100%;
	display: table;
}
.sub-tr {
	display: table-row;
	height: 100%;
}
.sub-td {
	display: table-cell;
	height: 100%;
	text-align: center;
	vertical-align: middle;
	// border: 1px solid gray;
}
</style>
  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值