当前位置:沸点梦工场 > 网页设计教程 > Dreamweaver教程 > 浏览文章

教你制作三维效果的表格

本站原创 2008年02月28日 【字体:

HTML表格带立体效果的三维表格,是依靠边线亮度实现的。边线亮色分明色(Light)和暗色( Dark)两种,一般使用其默认值即可,但也是可以调整的。调整表格边框亮度实际上就是指定其明暗两种颜色,由TABLE元素的borderColorLight、borderColorDark属性来定义。

1、下例是将边框明色设为白色,暗色设为紫酱色:
(编者注:为了让HTML源代码正常显示,已将所有“< ”符号的右边加了一个空格,实际应用时需将该空格去掉。)
点此在新窗口浏览图片
代码:
< table cellspacing=1 border=1 bordercolorlight=white bordercolordark=maroon>
< tr>
< th>Food< /th>
< th>Drink< /th>
< th>Sweet< /th>
< tr>
< td>A< /td>
< td>B< /td>
< td>C< /td>
< /tr>
< /table>
以上是对bordercolorlight、bordercolordark属性简单应用。

2、上面的三维效果是凹下去的,现在让我们把明暗色对换一下看看效果如何:
点此在新窗口浏览图片
代码:
< table cellspacing=1 border=1 bordercolorlight=white bordercolordark=maroon>
< tr>
< th>Food< /th>
< th>Drink< /th>
< th>Sweet< /th>
< tr>
< td>A< /td>
< td>B< /td>
< td>C< /td>
< /tr>
< /table>

3、给表格加底色
点此在新窗口浏览图片
代码:
< table cellspacing=1 border=1 bordercolorlight=white bordercolordark=maroon bgcolor=fdc0c0>
< tr>
< th>Food< /th>
< th>Drink< /th>
< th>Sweet< /th>
< tr>
< td>A< /td>
< td>B< /td>
< td>C< /td>
< /tr>
< /table>
啊!这就是颜色浑然一体的三维表格了,看看是不是比上面那个没加底色的表格好看多了。

4、再看个示例:
点此在新窗口浏览图片
代码:
< table cellspacing=1 border=1 borderColorDark=#fdfeff borderColorLight=#99ccff bgColor=#e0f0ff>
< tr>
< th>Food< /th>
< th>Drink< /th>
< th>Sweet< /th>
< tr>
< td>A< /td>
< td>B< /td>
< td>C< /td>
< /tr>
< /table>