css3 表格分两栏竖向排列,效果非常干净清爽(纵向显示)

一般表格显示效果为
在这里插入图片描述

竖向效果

在这里插入图片描述
css代码,如果需要只在手机上显示这种效果,可能用到媒体查询
@media only screen and (max-width:760px){这里是css代码} 如果不需要,可以直接这样
测试时,请去掉其它样式的影响,单独 进行测试.否则可能会被干扰

.table-responsive-y table,.table-responsive-y thead,.table-responsive-y tbody,.table-responsive-y th,.table-responsive-y td,.table-responsive-y tr{display:block}
.table-responsive-y thead tr{position:absolute;top:-9999px;left:-9999px}
.table-responsive-y tr{border:1px solid #ccc}
.table-responsive-y td{border:0;border-bottom:1px solid #eee;position:relative;padding:5px;padding-left:20%;white-space:normal;text-align:left;height:auto!important;line-height:auto!important;;}
.table-responsive-y td:before{position:absolute;top:6px;left:6px;width:40%;/*这里可能没用*/padding-right:10px;white-space:nowrap;text-align:left;font-weight:bold;height:auto!important;line-height:auto!important;}
.table-responsive-y td:before{content:attr(data-title)}
.table-responsive-y h3 a{font-size:16px;color:#3cbfae;font-weight:bold}
<div class="table-responsive-y">
	<table class="">
		<thead>
			<tr>
				<th>
					起步
				</th>
				<th>
					CSS
				</th>
				<th>
					元件
				</th>
				<th>
					模块
				</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td data-title="起步">
					下载前端框架
				</td>
				<td data-title="CSS">
					文本
				</td>
				<td data-title="元件">
					网格系统
				</td>
				<td data-title="模块">
					框架
				</td>
			</tr>
			<tbody>
			</table>
			</div>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值