最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442

HTML和CSS做模拟表格对角线网页教程

日期:07-23    来源:中国设计秀    作者:cnwebshow.com

网页制作cnwebshow文章简介:HTML和css做网页实例教程:模拟表格对角线.
Kh1中国设计秀

本贴代码实现的是“模拟表格对角线”。Kh1中国设计秀

仅供新手参考学习,欢迎大家提出更多的实现方法。Kh1中国设计秀

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Kh1中国设计秀
<html xmlns="http://www.w3.org/1999/xhtml"> Kh1中国设计秀
<head> Kh1中国设计秀
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Kh1中国设计秀
<title>模拟表格对角线</title> Kh1中国设计秀
<style type="text/css"> Kh1中国设计秀
*{padding:0;margin:0;} caption{font-size:14px;font-weight:bold;} Kh1中国设计秀
   table{ border-collapse:collapse;border:1px #525152 solid;width:50%;margin:0 auto;margin-top:100px;} Kh1中国设计秀
   th,td{border:1px #525152 solid;text-align:center;font-size:12px;line-height:30px;background:#C6C7C6;} Kh1中国设计秀
   th{background:#D6D3D6;} /*模拟对角线*/Kh1中国设计秀
 .out{ border-top:40px #D6D3D6 solid;/*上边框宽度等于表格第一行行高*/Kh1中国设计秀
                                            width:0px;/*让容器宽度为0*/ Kh1中国设计秀
                                          height:0px;/*让容器高度为0*/ Kh1中国设计秀
         border-left:80px #BDBABD solid;/*左边框宽度等于表格第一行第一格宽度*/ Kh1中国设计秀
                                  position:relative;/*让里面的两个子容器绝对定位*/ } Kh1中国设计秀
   b{font-style:normal;display:block;position:absolute;top:-40px;left:-40px;width:35px;} Kh1中国设计秀
   em{font-style:normal;display:block;position:absolute;top:-25px;left:-70px;width:55x;} Kh1中国设计秀
  .t1{background:#BDBABD;} Kh1中国设计秀
</style> Kh1中国设计秀
</head> Kh1中国设计秀
<body> Kh1中国设计秀
   <table> Kh1中国设计秀
     <caption>用div+css模拟表格对角线</caption> Kh1中国设计秀
     <tr> Kh1中国设计秀
       <th style="width:80px;"> Kh1中国设计秀
          <div class="out"> <b>类别</b> <em>姓名</em> </div> Kh1中国设计秀
       </th> Kh1中国设计秀
       <th>年级</th> Kh1中国设计秀
       <th>班级</th> Kh1中国设计秀
       <th>成绩</th> Kh1中国设计秀
       <th>班级均分</th> Kh1中国设计秀
      </tr> Kh1中国设计秀
      <tr> Kh1中国设计秀
         <td class="t1">张三</td> Kh1中国设计秀
         <td>三</td> Kh1中国设计秀
         <td>2</td> Kh1中国设计秀
         <td>62</td> Kh1中国设计秀
         <td>61</td> Kh1中国设计秀
       </tr> Kh1中国设计秀
       <tr> Kh1中国设计秀
           <td class="t1">李四</td> Kh1中国设计秀
           <td>三</td> <td>1</td> Kh1中国设计秀
           <td>48</td> <td>67</td> Kh1中国设计秀
       </tr> Kh1中国设计秀
       <tr> Kh1中国设计秀
           <td class="t1">王五</td> Kh1中国设计秀
           <td>三</td> <td>5</td> Kh1中国设计秀
           <td>79</td> <td>63</td> Kh1中国设计秀
        </tr> Kh1中国设计秀
        <tr> <td class="t1">赵六</td> <td>三</td> <td>4</td> <td>89</td> <td>66</td> </tr> Kh1中国设计秀
   </table> Kh1中国设计秀
</body> Kh1中国设计秀
</html>Kh1中国设计秀