固定列宽的表格

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <base target="_blank" />
    <title>三十客 - 【表格】一个固定列宽的表格示例</title>
    <style>
        .users {
          table-layout: fixed;
          width: 100%;
          white-space: nowrap;
        }
        .row-ID {
          width: 10%;
        }
        .row-name {
          width: 30%;
        }
        .row-job {
          width: 20%;
        }
        .row-desc {
          width: 40%;
        }
        .users td {
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
        .users th {
          background: darkblue;
          color: white;
        }
        .users td,
        .users th {
          text-align: left;
          padding: 5px 10px;
        }
        .users tr:nth-child(even) {
          background: lightblue;
        }
    </style>
</head>
<body>
    <table class="users">
      <thead>
        <tr>
          <th class="row-1 row-ID">ID</th>
          <th class="row-2 row-name">姓名</th>
          <th class="row-3 row-job">职位</th>
          <th class="row-4 row-desc">描述<th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>0001</td>
          <td>毛三十</td>
          <td>前端工程师</td>
          <td>这名员工是我所见过的最差劲的前端工程师,没有之一</td>
        </tr>
        <tr>
          <td>0002</td>
          <td>毛三胖dddddddddddddddddddddddddddddrrrrrrrrddddddddd</td>
          <td>JAVA程序员</td>
          <td>一个合格的程序员</td>
        </tr>
      </tbody>
    </table>
</body>
</html>

原文链接:固定列宽的表格及示例演示 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值