日期:2014-05-17  浏览次数:20680 次

<tr 设置背景色 怎么是一段一段的 求解`
html 代码:
<table style="width:100%;">
    <tr style="background-color:rgb(220,220,220); height:30px; width:100%;">
       <th style="font-size:12px;">图片</th>
<th style="font-size:12px;">产品名称</th>
<th style="font-size:12px;">价格</th>
<th style="font-size:12px;">创建时间</th>
<th style="font-size:12px;">操作</th>
<th style="font-size:12px;">状态</th>
     </tr>
.......
</table>


效果如下:


为什么是一段一段的  怎么才能是一个整体  多谢~~~~~~~~~~~~~~~~~~~~

------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<table style="width:100%;border-collapse:collapse" >
    <tr style="background-color:rgb(220,220,220); height:30px; width:100%;">
       <th style="font-size:12px;">图片</th>
    <th style="font-size:12px;">产品名称</th>
    <th style="font-size:12px;">价格</th>
    <th style="font-size:12px;">创建时间</th>
    <th style="font-size:12px;">操作</th>
    <th style="font-size:12px;">状态</th>
     </tr>
.......   
</table>
</body>
</html>
这样试试
------解决方案--------------------
我帮你简化一下楼上的意思:给table的style里设置border-collapse属性为collapse,会分成一段一段就是因为各个th都有自己的边框,将border-collapse设为collapse就是要合并边框,就能够不分段了
------解决方案--------------------