求教如何去除table每行之间的空白间隙?

qingumiyin 2011-10-29 09:00:43
<!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=GB2312"/>
<title>test table border</title>
<style type="text/css">
table{
border:0;
cellspacing:0;
cellpadding:0;
}

table tr{
border:none;
padding:0;
margin:0;
}

table td{
background:#cccc99;
border-bottom:3px solid red;
border-top:3px solid blue;
margin:0;
padding:7px;
}

table td:hover{
background:#ccdd00;
cursor:pointer;
}

</style>

</head>

<body>
<table id="text">
<tr>
<td>This is kongkongde</td>
<td>This is kongkongde</td>
<td>This is kongkongde</td>
</tr>
<tr>
<td>This is kongkongde</td>
<td>This is kongkongde</td>
<td>This is kongkongde</td>
</tr>
<tr>
<td>This is kongkongde</td>
<td>This is kongkongde</td>
<td>This is kongkongde</td>
</tr>
</table>
</body>
</html>

不能上传图片。
请问如何将表格行之间的空白去除啊?
谢谢!
...全文
2325 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
gleams 2011-10-30
  • 打赏
  • 举报
回复
2楼正解
border-collapse: collapse; padding: 0;
css2.0的帮助手册里说明的。
wwwhhb4001 2011-10-30
  • 打赏
  • 举报
回复

学习一下
阿妈的乖女儿 2011-10-30
  • 打赏
  • 举报
回复
哦哦,我只知道是在这个<table id="text" cellspacing=0 cellpadding=0>里面写,在css里面没写过,原来如此啊,学习了
greedisgood5000 2011-10-30
  • 打赏
  • 举报
回复
cellspacing=0 cellpadding=0
是属性,不是CSS样式,不能写在CSS里边的,你要写在CSS的话,这样写
table { border-collapse: collapse; padding: 0;}
孟子E章 2011-10-29
  • 打赏
  • 举报
回复
<table id="text" cellspacing=0 cellpadding=0>
这些属性不能写在css里面的

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧