响应式表格

宽屏下表格

122101_81vf_3529780.png

移动端效果

122201_dKg3_3529780.png

<style>
*{margin:0px;padding:0px;font-size:14px;}
h1{font-size:30px;text-align: center;color:#666;}
.responsive{width:98%;margin:0px auto;border:1px solid #666;box-shadow: 0 0 10px 0 rgba(0,0,0,0.5);}
.responsive th,.responsive td{border:1px solid #666;padding:.5em 1em}
.responsive th{background:#35B558;}
.responsive .actions a{color:#ff5c00;text-decoration: none;padding:0px 4px;}
.responsive .number,.responsive .actions{text-align: center;}
@media (max-width:480px ) {
    .responsive{box-shadow: none;border: none;}
    .responsive thead{display:none;}
    .responsive tr,.responsive td{display: block;border: none;position: relative;}
    .responsive tr{margin-bottom: 1em;box-shadow: 0 1px 10px 0 rgba(0,0,0,0.2);}
    .responsive .number{background:#35B558;text-align: left;padding-left:28%;}
    .responsive .number::before{content: "课程序号";position: absolute;left:0.5em;top:0.5em;font-weight: bold;}
    .responsive .name{text-align: left;padding-left:28%;}
    .responsive .name::before{content: "课程名称";position: absolute;left:0.5em;top:0.5em;font-weight: bold;}
    .responsive .actions{position:absolute;right:0px;top:0px;}
    
}
</style>

HTML

<h1>相关课程</h1>
        <table class="responsive" cellspacing="0" cellpadding="0">
            <thead>
                <tr>
                    <th>课程序号</th>
                    <th>课程名称</th>
                    <th>课程操作</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="number">150406</td>
                    <td class="name">移动应用开发课程</td>
                    <td class="actions">
                        <a href="#">修改</a><a href="del">删除</a>
                    </td>
                </tr>
                <tr>
                    <td class="number">150406</td>
                    <td class="name">Web前端开发课程</td>
                    <td class="actions">
                        <a href="#">修改</a><a href="del">删除</a>
                    </td>
                </tr>
                <tr>
                    <td class="number">150406</td>
                    <td class="name">操作系统&数据库系列课程</td>
                    <td class="actions">
                        <a href="#">修改</a><a href="del">删除</a>
                    </td>
                </tr>
            </tbody>
        </table>

 

转载于:https://my.oschina.net/u/3529780/blog/920068

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值