表单实现对角线

<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>表格对角线</title>
  <style type="text/css">
    * {
      padding: 0;
      margin: 0;
    }

    caption {
      font-size: 14px;
      font-weight: bold;
    }

    table {
      border-collapse: collapse;
      border: 1px #525152 solid;
      width: 600px;
      margin: 0 auto;
      margin-top: 100px;
    }

    th,
    td {
      border: 1px #525152 solid;
      text-align: center;
      font-size: 12px;
      line-height: 30px;
      background: #C6C7C6;
    }

    th {
      background: #D6D3D6;
    }

    /*模拟对角线*/
    

   /* b {
      font-style: normal;
      display: block;
      position: absolute;
      top: -40px;
      left: -40px;
      width: 35px;
    } */

    /* em {
      font-style: normal;
      display: block;
      position: absolute;
      top: -25px;
      left: -70px;
      width: 55x;
    } */

.out{
    height: 40px;
    position: relative;
}
b{
    font-style: normal;
    display: block;
    position: absolute;
    top: 0px;
    right: -2px;
    width: 35px;
}
em{
    font-style: normal;
    display: block;
    position: absolute;
    bottom: 0px;
    left: -10px;
    width: 55px;
}
span{
    display: block;
    width: 89px;
    height: 1px;
    background: red;
    transform: rotate(26deg);
    position: absolute;
    top: 18px;
    left: -6px;
}
    .t1 {
      background: #BDBABD;
    }
  </style>
</head>

<body>
  <table>
    <caption>
      用div+css模拟表格对角线
    </caption>
    <tr>
      <th style="width:80px;">
        <div class="out"> <b>类别</b><span></span> <em>姓名</em> </div>
      </th>
      <th>年级</th>
      <th>班级</th>
      <th>成绩</th>
    </tr>
    <tr>
      <td class="t1">张三</td>
      <td>三</td>
      <td>2</td>
      <td>99</td>
    </tr>
    <tr>
      <td class="t1">李四</td>
      <td>三</td>
      <td>1</td>
      <td>95</td>
    </tr>
  </table>
</body>

</html>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值