时间:2021-07-01 10:21:17 帮助过:10人阅读
.out { border-width:1px;border-style:solid;border-color:#dddddd #777777 #777777 #dddddd } .in { border-width:1px;border-style:solid;border-color:#777777 #dddddd #dddddd #777777; background:#ffcccc }
第二步:建立一个1x1的表格,高和宽均为100,cellspacing设为1,如下所示:
第三步:对整个表格(即table标签)采用out样式,而单元格(即td标签)采用in样式。现在存盘看看效果吧,是不是和下面的一样?
学会了1x1的3D边框的表格的制作,要做出本例的效果就不难了,读者不妨自己摸索一下。
#p#
前面我们通过举例讲述了一些用css美化表格边框的方法,您可以尝试不同的组合,从而做出更漂亮的表格!为了方便你学习,这里为你提供了各种效果表格的全部代码,您可以将代码复制到写字板生成一个txt文件,然后将其扩展名改为htm,这样就可以用Ie直接打开了。
代码如下
<html> <head> <title>用css美化表格边框</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <style> .table1 { border:#000000 dashed;border-width:1 0 0 1 } .td1 { border:#000000 dashed;border-width:0 1 1 0 } .table2 { border:#cc0000 solid;border-width:1 0 0 1; background:#ffffff } .td2 { border:#cc0000 solid;border-width:0 1 1 0 } .table3 { border:green dotted;border-width:2 0 0 2 } .td3 { border:green dotted;border-width:0 2 2 0 } .table4 { border:blue solid;border-width:2 1 1 2 } .td4 { border:blue solid;border-width:0 1 1 0 } .table5 { border:teal 4 double } .td5 { border:teal 1 solid } .table6 { border:3 outset } .td6 { border: 1 solid } .table7 { border:3 inset } .td7 { border:1 solid } .table8 { border:#ee0000 3 ridge } .td8 { border:1 solid } .table9 { border: 4 skyblue ridge } .td9 { border:1 navy groove ;background:#ffffff } .td10 { border:maroon 3 double } .table11 {border:purple 4 ;border-style:dashed double} .td11 { border:1 solid } .out { border-width:1;border-style:solid; border-color:#cccccc #333333 #333333 #cccccc } .in { border-width:1;border-style:solid; border-color:#333333 #cccccc #cccccc #333333;background:#ffcccc } </style> </head> <body bgcolor="#FFFFFF" text="#000000"> <p align="center"> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table1"> <tr > <td class=td1> </td> <td class="td1"> </td> <td class="td1"> </td> </tr> <tr> <td class="td1"> </td> <td class="td1"> </td> <td class="td1"> </td> </tr> <tr> <td class="td1"> </td> <td class="td1"> </td> <td class="td1"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table2"> <tr > <td class="td2"s> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> <tr> <td class="td2"> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> <tr> <td class="td2"> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table3"> <tr > <td class="td3"s> </td> <td class="td3"> </td> <td class="td3"> </td> </tr> <tr> <td class="td3"> </td> <td class="td3"> </td> <td class="td3"> </td> </tr> <tr> <td class="td3"> </td> <td class="td3"> </td> <td class="td3"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table4"> <tr > <td class="td4"> </td> <td class="td4"> </td> <td class="td4"> </td> </tr> <tr> <td class="td4"> </td> <td class="td4"> </td> <td class="td4"> </td> </tr> <tr> <td class="td4"> </td> <td class="td4"> </td> <td class="td4"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table5"> <tr > <td class="td5"> </td> <td class="td5"> </td> <td class="td5"> </td> </tr> <tr> <td class="td5"> </td> <td class="td5"> </td> <td class="td5"> </td> </tr> <tr> <td class="td5"> </td> <td class="td5"> </td> <td class="td5"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table6"> <tr > <td class="td6"> </td> <td class="td6"> </td> <td class="td6"> </td> </tr> <tr> <td class="td6"> </td> <td class="td6"> </td> <td class="td6"> </td> </tr> <tr> <td class="td6"> </td> <td class="td6"> </td> <td class="td6"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table7"> <tr > <td class="td7"> </td> <td class="td7"> </td> <td class="td7"> </td> </tr> <tr> <td class="td7"> </td> <td class="td7"> </td> <td class="td7"> </td> </tr> <tr> <td class="td7"> </td> <td class="td7"> </td> <td class="td7"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table8"> <tr > <td class="td8"> </td> <td class="td8"> </td> <td class="td8"> </td> </tr> <tr> <td class="td8"> </td> <td class="td8"> </td> <td class="td8"> </td> </tr> <tr> <td class="td8"> </td> <td class="td8"> </td> <td class="td8"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="1" cellpadding="0" border="0" class="table9"> <tr > <td class="td9"> </td> <td class="td9"> </td> <td class="td9"> </td> </tr> <tr> <td class="td9"> </td> <td class="td9"> </td> <td class="td9"> </td> </tr> <tr> <td class="td9"> </td> <td class="td9"> </td> <td class="td9"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="2" cellpadding="0" border="0"> <tr > <td class="td10"> </td> <td class="td10"> </td> <td class="td10"> </td> </tr> <tr> <td class="td10"> </td> <td class="td10"> </td> <td class="td10"> </td> </tr> <tr> <td class="td10"> </td> <td class="td10"> </td> <td class="td10"> </td> </tr> </table> <p> </p> <table width="500" cellspacing="0" cellpadding="0" border="0" class="table11"> <tr > <td class="td11"> </td> <td class="td11"> </td> <td class="td11"> </td> </tr> <tr> <td class="td11"> </td> <td class="td11"> </td> <td class="td11"> </td> </tr> <tr> <td class="td11"> </td> <td class="td11"> </td> <td class="td11"> </td> </tr> </table> <p> </p> <table width="500" border="0" cellspacing="1" cellpadding="0" style="border:#cc0000 1 solid" > <tr> <td> <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" class="table2"> <tr > <td class="td2"> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> <tr> <td class="td2"> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> <tr> <td class="td2"> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> </table> </td> </tr> </table> <p> </p> <table width="500" border="0" cellspacing="3" cellpadding="0" style="border:#cc0000 1 solid" background="back.jpg"> <tr> <td> <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" class="table2"> <tr > <td class="td2"> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> <tr> <td class="td2"> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> <tr> <td class="td2"> </td> <td class="td2"> </td> <td class="td2"> </td> </tr> </table> </td> </tr> </table> <p> </p> <table width="500" cellspacing="2" cellpadding="0" border="0" style="border:1 navy solid" background="back.jpg"> <tr > <td class="td9"> </td> <td class="td9"> </td> <td class="td9"> </td> </tr> <tr> <td class="td9"> </td> <td class="td9"> </td> <td class="td9"> </td> </tr> <tr> <td class="td9"> </td> <td class="td9"> </td> <td class="td9"> </td> </tr> </table> <p> </p> <table width="500" border="0" cellspacing="3" cellpadding="0"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> </tr> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> </tr> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="100%" class="out"> <tr> <td class="in"> </td> </tr> </table> </td> </tr> </table> </p> </body> </html>
以上就是HTML表格标记教程(48):CSS修饰表格_HTML/Xhtml_网页制作的内容,更多相关内容请关注PHP中文网(www.gxlcms.com)!