table的css样式

时间:2022-03-19 05:46:56

经常会遇到table中各种线条重复的问题,画面会显得很难看,下面是解决问题的方法;

<!Doctype html>
<html>
<head>
<meta charset='UTF-8'/>
<style>
body{
font-family:Microsoft YaHei;
}
/*table{
border-top:1px gray solid;
border-left:1px gray solid;
}
th{
background-color:rgb(240,240,240);
}
th,td{
border-right:1px gray solid;
border-bottom:1px gray solid;
}*/
table{
background-color: gray;
}
th,td{
background-color: #fff;
}

</style>
</head>
<body>
<table cellspacing=1 cellpadding=10 border=0>
<caption><b>运费详情</b></caption>
<thead>
<tr><th>区域</th><th>寄达地</th><th>首重(元/1000g)</th><th>续重(元/1000g)</th></tr>
</thead>
<tbody>
<tr>
<th rowspan="2">一区</th>
<td>浙江、上海、江苏</td>
<td>6</td>
<td>1</td>
</tr>
<tr>

<td>江西、安徽</td>
<td>7</td>
<td>1</td>
</tr>
<tr>
<th>二区</th>
<td>吉林、黑龙江、云南</td>
<td>10</td>
<td>6</td>
</tr>
<tr>
<th>三区</th>
<td>*、*</td>
<td>15</td>
<td>10</td>
</tr>
</tbody>
</table>
</body>
</html>