Simulating table diagonals with div css

Source: Internet
Author: User

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> using a div CSS to emulate a table diagonal </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;}
/* Analog Diagonal */
. out{
border-top:40px #D6D3D6 solid;/* Border Width is equal to the first row of table row Height */
width:0px;/* make the container width 0*/
height:0px;/* make the container height 0*/
border-left:80px #BDBABD solid;/* The width of the left border is equal to the first width of the first row of the table *
position:relative;/* let the two sub-containers inside absolutely position */
}
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>
<body>
<table>
<caption> using a div CSS to emulate a table diagonal </caption>
<tr>
<th style= "width:80px;" >
<div class= "Out" >
<b> category </b>
<em> name </em>
</div>
</th>
<th> Grade </th>
<th> class </th>
<th> Results </th>
<th> class Sharing </th>
</tr>
<tr>
&LT;TD class= "T1" > Zhang San </td>
<td> three </td>
<td>2</td>
<td>62</td>
<td>61</td>
</tr>
<tr>
&LT;TD class= "T1" > John Doe </td>
<td> three </td>
<td>1</td>
<td>48</td>
<td>67</td>
</tr>
<tr>
&LT;TD class= "T1" > Harry </td>
<td> three </td>
<td>5</td>
<td>79</td>
<td>63</td>
</tr>
<tr>
&LT;TD class= "T1" > Zhao Liu </td>
<td> three </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>

Simulating table diagonals with div css

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.