Implementación de triángulos rectangulares en diagonal y en ángulo recto

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</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: 50%;
            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;
        }

        /*模拟对角线*/
        .out {
     
     
            border-bottom: 40px lightblue solid;
            width: 0px;
            height: 0px;
            border-left: 80px lightblue solid;
            position: relative;
        }

        span {
     
     
            color: white;
            font-style: normal;
            display: block;
            position: absolute;
            top: 0;
            left: -70px;
        }

        em {
     
     
            font-style: normal;
            display: block;
            position: absolute;
            top: 13px;
            color: white;
            left: -30px;
        }

        .t1 {
     
     
            background: #bdbabd;
        }

        .special::before {
     
     
            z-index: 99999;
            content: "";
            position: absolute;
            left: 0px;
            top: -29px;
            width: 100%;
            height: 50px;
            box-sizing: border-box;
            border-bottom: 1px solid white;
            transform-origin: bottom center;
            transform: rotateZ(334deg) scale(1.12);
        }
    </style>
</head>

<body>
    <table>
        <caption>
            用div+css模拟表格对角线
        </caption>
        <tr>
            <th style="width: 80px;position: relative;" class="special">
                <div class="out"><span>类别</span> <em>姓名</em></div>
            </th>
            <th>年级</th>
            <th>班级</th>
            <th>成绩</th>
            <th>班级均分</th>
        </tr>
        <tr>
            <td class="t1">张三</td>
            <td></td>
            <td>2</td>
            <td>62</td>
            <td>61</td>
        </tr>
        <tr>
            <td class="t1">李四</td>
            <td></td>
            <td>1</td>
            <td>48</td>
            <td>67</td>
        </tr>
        <tr>
            <td class="t1">王五</td>
            <td></td>
            <td>5</td>
            <td>79</td>
            <td>63</td>
        </tr>
        <tr>
            <td class="t1">赵六</td>
            <td></td>
            <td>4</td>
            <td>89</td>
            <td>66</td>
        </tr>
    </table>
</body>

</html>

Enlace de referencia:
1.https: //www.jb51.net/css/16650.html
2.https: //www.cnblogs.com/chun6/p/6132258.html

Supongo que te gusta

Origin blog.csdn.net/qq_26889291/article/details/108867947
Recomendado
Clasificación