html table实现无左右边框布局

2021-10-04 07:19

阅读:975

标签:除了   char   ini   name   ack   size   alt   dev   去掉   这是一个普通的表格,border=1,每个td都会有边框。 放手机里,table的左右边框明显有点多余且不美观。 那么如何去掉呢? 因为表格边框最终还是取决于td的。操作整个table的边框无法实现效果。 实现思路如下: 1、table的边框只留上边框和下边框  .table{   border-top: 1px solid #e8e8e8;   border-bottom:1px solid #e8e8e8; } 2、th或td的边框最左边不要 .table td,.table th{ border:1px solid #e8e8e8;   border-left:none; } 3、这时候表格最右边还有边框,可以用这个去除 .table tr th:last-child{border-right:none;} .table tr td:last-child{border-right:none;} 最终的效果,table左边和右边的边框去除了: 最后贴下源码 *{margin:0;padding:0;} .table{table-layout: fixed;font-size:13px;width:100%;text-align:center;margin-top:10px; border-top: 3px solid #e8e8e8;border-bottom: 3px solid #e8e8e8;border-collapse:collapse;} .table th{background:#F0F4FB;} .table th,.table td{height:45px;border:3px solid #e8e8e8;border-left:none;} .table tr th:last-child{border-right:none;} .table tr td:last-child{border-right:none;} 姓名 年龄 成绩 班级 张三 15 230 42 李四 16 180 43 王五 15 250 42  html table实现无左右边框布局标签:除了   char   ini   name   ack   size   alt   dev   去掉   原文地址:http://www.cnblogs.com/xin-yu/p/7653195.html


评论


亲,登录后才可以留言!