CSS控制表格边框样式问题

html-css018

CSS控制表格边框样式问题,第1张

<html>

<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,单元格左边没有边框,上下和右边有边框,颜色你可以自己设置。

用css控制表格间距为1px的样式方法:

css样式

.table{margin:0 0 15px 0border-collapse:collapse}

.table td{ background:#ffefedpadding:0 border-spacing:1pxborder:1px #fbaaa0 solid}

border-collapse:collapse

加在table的样式中

border-spacing:1px

border:1px #fbaaa0 solid

这两句加在td的样式中