css 实现 table斜线表头

  1. border-left  border-right border-top border-bottom 能实现特殊形状  
[html]  view plain  copy
 
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5. <title>资费标准</title>  
  6. <style type="text/css">  
  7. table {  
  8.     border-collapse: collapse;  
  9.     border: 1px #e3e3e3 solid;  
  10.     width: 96%;  
  11.     margin: 0 auto;  
  12.     margin-top: 30px;  
  13.     margin-bottom:50px;  
  14. }  
  15.   
  16. th, td {  
  17.     border: 1px solid #e3e3e3;  
  18.     text-align: center;  
  19.     font-size: 35px;  
  20.     line-height: 100px;  
  21.     background: #C6C7C6;  
  22. }  
  23.   
  24. th {  
  25.     background: #199fff;  
  26.     color: white;  
  27. } /*模拟对角线*/  
  28. .out {  
  29.     border-top: 5em #199fff solid; /*上边框宽度等于表格第一行行高*/  
  30.     border-left: 200px #ff8838 solid; /*左边框宽度等于表格第一行第一格宽度*/  
  31.     position: relative; /*让里面的两个子容器绝对定位*/  
  32.     color:white;  
  33. }  
  34.   
  35. b {  
  36.     font-style: normal;  
  37.     display: block;  
  38.     position: absolute;  
  39.     top: -5.3em;  
  40.     left: -160px;  
  41.     width: 200px;  
  42. }  
  43.   
  44. em {  
  45.     font-style: normal;  
  46.     display: block;  
  47.     position: absolute;  
  48.     top: -78px;  
  49.     left: -230px;  
  50.     width: 200px;  
  51. }  
  52.   
  53. .assessDetail td {  
  54.     background-color: #FFF;  
  55. }  
  56. </style>  
  57. </head>  
  58. <body style="background-color: #f0f0f6;color:#404040;">  
  59.     <table>  
  60.         <tr>  
  61.             <th style="width:200px;">  
  62.                 <div class="out" style="font-size:27px">  
  63.                     <b>消费类型</b> <em>通话类型</em>  
  64.                 </div>  
  65.             </th>  
  66.             <th>通话时长</th>  
  67.             <th>虚拟币</th>  
  68.         </tr>  
  69.   
  70.         <tr  class="assessDetail">     
  71.               <td>国内直拨</td>     
  72.               <td>1 时长/分钟</td>     
  73.               <td>0.05/分钟</td>     
  74.           </tr>     
  75.           <tr  class="assessDetail">     
  76.               <td>国内回拨</td>     
  77.               <td>2 时长/分钟</td>     
  78.               <td>0.1/分钟</td>     
  79.           </tr>   
  80.           <tr  class="assessDetail">     
  81.               <td>洛杉矶</td>     
  82.               <td>1 时长/分钟</td>     
  83.               <td>0.2/分钟</td>     
  84.           </tr>   
  85.           <tr  class="assessDetail">     
  86.               <td >温哥华</td>     
  87.               <td>1 时长/分钟</td>     
  88.               <td>0.5/分钟</td>     
  89.           </tr>   
  90.           <tr  class="assessDetail">     
  91.               <td >香港</td>     
  92.               <td>1 时长/分钟</td>     
  93.               <td>0.3/分钟</td>     
  94.           </tr>   
  95.         <tr>  
  96.         </tr>  
  97.     </table>  
  98. </body>  
  99. </html>  

猜你喜欢

转载自690878204.iteye.com/blog/2333625