用div css類比表格對角線,divcss表格對角線

來源:互聯網
上載者:User

用div css類比表格對角線,divcss表格對角線
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title>用div css類比表格對角線</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-top:40px #D6D3D6 solid;/*上邊框寬度等於表格第一行行高*/ 
width:0px;/*讓容器寬度為0*/ 
height:0px;/*讓容器高度為0*/ 
border-left:80px #BDBABD solid;/*左邊框寬度等於表格第一行第一格寬度*/ 
position:relative;/*讓裡面的兩個子容器絕對位置*/ 
} 
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;} 
.t1{background:#BDBABD;} 
</style> 
</head> 
<body> 
<table> 
<caption>用div css類比表格對角線</caption> 
<tr> 
<th style="width:80px;"> 
<div class="out"> 
<b>類別</b> 
<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> 
<div><A href="http://www.999jiujiu.com/">http://www.999jiujiu.com/</A></div>
</body> 
</html> 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.