<head><title>HTML
Table</title></head>
<style
type="text/css">
TABLE
{
border-collapse:
separate
border:
2px
solid
blue
}
.one{
border-left:none
border-right:1px
solid
#f00
border-top:1px
solid
#f00
border-bottom:1px
solid
#f00}
</style>
<body>
<table
summary="TechRepublic.com
-
Tables
and
CSS">
<thead><tr>
<thabbr="salesperson"
scope="col">Person</th>
<thabbr="sales"
scope="col">Sales</th>
</tr></thead>
<tbody><tr>
<td
class="one">Mr.
Smith</td>
<td>600.00</td>
</tr><tr>
<td>Mr.
Jones</td>
<td>0000.00</td>
</tr><tr>
<td>Ms.
Williams</td>
<td
class="one">0000.00</td>
</tr></tbody>
<tfoot><tr>
<td>Let's
sale,
sale,
sale!</td>
</tr></tfoot></table></body></html>
我设置了一个样式one,单元格左边没有边框,上下和右边有边框,颜色你可以自己设置。
1、将css写成jsp的格式,动态生成css<%@ page contentType="text/csscharset=utf-8" pageEncoding="utf-8" %>
<% // 从数据库或配置文件读取系统管理员设置的系统参数 %>
body { background: <%= bodyBackground %>} /* 应用参数 */
...
2、如要换肤之类,样式修改比较多,应用较多页面的情况,建议将不同样式写入不同的CSS文件,通过jsp/servlet将css的选择参数写入session或application,然后在jsp中判断进行选择
<c:if test='${not empty param.theme}'><c:set var='css' scope='session'>${param.theme}</c:set></c:if>
<link rel="stylesheet" type="text/css" href="<c:url value='/css/${session.css}.css'/>"></link>