在HTML中顯示帶斜線的表格


<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
</head>
<style type="text/css">
table{
border-collapse:collapse;
}
table,tr,td{
border:1px solid black;
}
td{
width:150px;/*這里需要自己調整,根據自己的需求調整寬度*/
height:50px;/*這里需要自己調整,根據自己的需求調整高度*/
position: relative;
}
td[class=first]:before{
content: "";
position: absolute;
width: 1px;
height:159px;/*這里需要自己調整,根據td的寬度和高度*/
top:0;
left:0;
background-color: black;
display: block;
transform: rotate(-71.5deg);/*這里需要自己調整,根據線的位置*/
transform-origin: top;
}

</style>
<body>
<table>
<tr>
<th>姓名</th>
<th>年齡</th>
<th>性別</th>
</tr>
<tr>
<td class="first"></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM