表格的一行高度设置为0了,仍然显示一条线,怎么才能去掉

shfzhzhr 2009-07-02 10:18:57
我把表格的一行的所有单元格高度都设置为0了,tr的高度也设置为0,边框宽度也都设置为0了,但是这个tr仍然显示为一条黑线
,各位大侠帮帮忙,表格的cellpadding=0 cellspacing=0也都设置了,表格是fixed布局的

...全文
1207 40 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
40 条回复
切换为时间正序
请发表友善的回复…
发表回复
cqhweb 2009-08-21
  • 打赏
  • 举报
回复
<html> 
<head>
<meta http-equiv="content-type" content="text/html; charset=GBK">
<style>
.web_table {
border:1px solid #C8C8C8;
z-index: 0;
table-layout:fixed;
border-spacing:0px;
border-collapse:collapse;
width:0px;
height:0px;
padding:0px;
margin:0px;
}

.grid_cell2{
border-top-color:#ffffff;
border-left-color:#ffffff;
border-right-color:#808080;
border-bottom-color:#808080;
border-top-style:solid;
border-left-style:solid;
border-right-style:solid;
border-bottom-style:solid;
border-top-width:1px;
border-left-width:1px;
border-right-width:1px;
border-bottom-width:1px;
font-size:12px;
text-align:center;
vertical-align:middle;
font-family:"宋体";
width:51px;
height:20px;
}

.grid_cell{
border-top-color:#ffffff;
border-left-color:#ffffff;
border-right-color:#808080;
border-bottom-color:#808080;
border-top-style:solid;
border-left-style:solid;
border-right-style:solid;
border-bottom-style:solid;
border-top-width:1px;
border-left-width:1px;
border-right-width:1px;
border-bottom-width:1px;
color:#000FFF;
background-color: #FFFFFF;
font-size:12px;
text-align:center;
vertical-align:middle;
font-family:"宋体";
cursor:default;
width:51px;
height:20px;
white-space:nowrap;
border-collapse:collapse;
text-overflow:ellipsis;
}

tr{
overflow:hidden;
font-size:0px;
}
</style>
</head>
<body>
<table class="web_table" id="web_table" cellpadding="0" cellspacing="0">
<tr>
<td class='grid_cell2'> aa </td>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
</tr>
<tr>
<td class='grid_cell'>bbb </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> col3 </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
</tr>
<tr>
<td class='grid_cell'> </td>
<td class='grid_cell' > </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
</tr>
<tr>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> col3 </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
</tr>
<tr>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> col3 </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
</tr>
</table>
</body>
</html>
hjx398 2009-08-21
  • 打赏
  • 举报
回复
//下面的就可以实现
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=GBK">
<style>
.web_table {
border:1px solid #C8C8C8;
z-index: 0;
table-layout:fixed;
border-spacing:0px;
border-collapse:collapse;
width:0px;
height:0px;
padding:0px;
margin:0px;
}

.grid_cell2{
border:none;
width:81px;
height:0px;
white-space:nowrap;
border-collapse:collapse;
padding:0px;
margin:0px;
}

.grid_cell{
border-top-style:solid;
border-left-style:solid;
border-right-style:solid;
border-bottom-style:solid;
border-top-width:1px;
border-left-width:1px;
border-right-width:1px;
border-bottom-width:1px;
color:#000FFF;
background-color: #FFFFFF;
font-size:40px;
text-align:center;
vertical-align:middle;
font-family:"宋体";
cursor:default;
width:51px;
height:20px;
white-space:nowrap;
border-collapse:collapse;
padding:0px;
margin:0px;
text-overflow:ellipsis;
border-color:blcak;
}

tr{
overflow:hidden;
text-overflow:ellipsis;
}
.mycss{
border-width:0px;
border-bottom-style:none;
}
.mycss2{
border:1px solid #000FFF;
border-top-width:0px;
color:#000FFF;
font-size:40px;
text-align:center;
vertical-align:middle;
font-family:"宋体";
}
</style>
</head>
<body>

<table class="web_table" id="web_table" cellpadding="0" cellspacing="0" boder="1">
<tr>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
<td class='grid_cell2'> </td>
</tr>
<tr>
<td class='grid_cell'> 1</td>
<td class='grid_cell'> </td>
<td class='grid_cell'> col3 </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
</tr>

<tr class="mycss">
<td class="mycss"> </td>
<td class="mycss"> </td>
<td class="mycss"> </td>
<td class="mycss"> </td>
<td class="mycss"> </td>
<td class="mycss"> </td>

</tr>
<tr>
<td class='mycss2'> 3</td>
<td class='mycss2'> </td>
<td class='mycss2'> col3 </td>
<td class='mycss2'> </td>
<td class='mycss2'> </td>
<td class='mycss2'> </td> </tr>
<tr>
<td class='grid_cell'>4 </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> col3 </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
<td class='grid_cell'> </td>
</tr>
</table>
</body>
</html>
bhbhxy 2009-08-21
  • 打赏
  • 举报
回复
overflow:hidden; height:0; line-height:0

cellspacing=0 cellpadding=0
单元格中不要有任何字符,比如 这种去掉
appl33205 2009-08-21
  • 打赏
  • 举报
回复
把   删了
ivftivft 2009-08-19
  • 打赏
  • 举报
回复
还有,在<table>中 border="0" 和 style="border:0" 的意义是不同的,border="0"定义所有的每个单元格的边框粗细,style="border:0"是定义整个<table>最外面的边框的粗细,并不定义单元格。并且在<table>中定义 border="0" 和在单元格中定义 style="border:0" 的效果也是不同的。
ivftivft 2009-08-19
  • 打赏
  • 举报
回复
注意在<table>中 border="0"和 style="border-collapse: collapse"同时使用。
ivftivft 2009-08-19
  • 打赏
  • 举报
回复

<table border="0" width="100%" id="table1" style="border-collapse: collapse">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
shfzhzhr 2009-08-19
  • 打赏
  • 举报
回复
[Quote=引用 32 楼 fendy5201 的回复:]
上面的方法都解决不了啊。
[/Quote]
嗯,好像都不行
mark620 2009-08-19
  • 打赏
  • 举报
回复
上面的方法都解决不了啊。
shfzhzhr 2009-08-19
  • 打赏
  • 举报
回复

<HTML>
<HEAD>
<style>

/*行标题单元格*/
.titleCell{
overflow:hidden;
background-color:#e4ecf7;
border-color:#9eb6ce;
border-style:solid;
border-left-width:0px;
border-top-width:0px;
border-right-width:1px;
border-bottom-width:1px;
text-align:center;
white-space:nowrap;
text-overflow:clip;
background-repeat:no-repeat;
background-position:center;
padding:0px;
margin:0px;
}

.web_table {
-moz-user-select: none;
z-index: 0;
background-color: #ffffff;
table-layout: fixed;
border-spacing:0px;
left:0px;
top:0px;
width:0px;
height:0px;
padding:0px;
margin:0px;
border-collapse: separate;
empty-cells: show;
}

.gridCell{
white-space:nowrap;
text-overflow:clip;
overflow:hidden;
background-repeat:no-repeat;
background-position:center;
border-left-width:0px;
border-top-width:0px;
border-right-width:1px;
border-bottom-width:1px;
border-style:solid;
border-color:#D0D7D5;
padding:0px;
margin:0px;

}


.firstRowCell{
border-color:#9eb6ce;
border-style:solid;
border-left-width:0px;
border-top-width:0px;
border-right-width:0px;
border-bottom-width:0px;

}

.firstColCell{
border-width:0px;
}

</style>
<Script>
function test(){
var cell = document.getElementById("a");
alert(cell.offsetHeight);
var row = document.getElementById("b");
alert(row.offsetHeight);
alert(cell.clientHeight);
alert(row.clientHeight);
}

</script>
</HEAD>
<BODY>

<TABLE class=web_table cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD class=firstRowCell style="WIDTH: 0px; HEIGHT: 0px"></TD>
<TD class=firstRowCell style="WIDTH: 50px"></TD>
<TD class=firstRowCell style="WIDTH: 100px"></TD>
<TD class=firstRowCell style="WIDTH: 100px"></TD>
<TD class=firstRowCell style="WIDTH: 100px"></TD>
<TD class=firstRowCell style="WIDTH: 100px"></TD></TR>
<TR>
<TD class=firstColCell style="HEIGHT: 20px"></TD>
<TD class=titleCell> </TD>
<TD class=titleCell>A</TD>
<TD class=titleCell>B</TD>
<TD class=titleCell>C</TD>
<TD class=titleCell>D</TD></TR>
<TR>
<TD class=firstColCell style="HEIGHT: 20px"></TD>
<TD class=titleCell>1</TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD></TR>

<TR id=b style="height:0px;border:none;border-width:0px;">
<TD style="HEIGHT: 0px;line;border:none;border-width:0px;height:0px;"></TD>
<TD style="border-width:0px;"></TD>
<TD id=a style="border:none;border-width:0px;height:0px;"></TD>
<TD style="border:none;border-width:0px;height:0px;"></TD>
<TD style="border:none;border-width:0px;height:0px;"></TD>
<TD style="border:none;border-width:0px;height:0px;"></TD></TR>

<TR>
<TD class=firstColCell style="HEIGHT: 20px"></TD>
<TD class=titleCell>3</TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD></TR>
<TR>
<TD class=firstColCell style="HEIGHT: 20px"></TD>
<TD class=titleCell>4</TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD>
<TD class=gridCell> </TD></TR></TBODY></TABLE>

<input type=button value="button" onclick="test();">

</BODY></HTML>


还是不行,代码如下,运行下js,可以看到高度为0,边框为0的行和单元格的offsetHeight和clientHeight都是1
falee 2009-08-05
  • 打赏
  • 举报
回复
<TABLE>
<TR>
<TD height="0"></TD>
</TR>
</TABLE>

最关键的地方是 你不要在<td></td>中间加空格
mark620 2009-07-17
  • 打赏
  • 举报
回复
设置border看看
robake 2009-07-16
  • 打赏
  • 举报
回复
你把表格的边框色设成你的页面的背景色试试
ya270078781 2009-07-14
  • 打赏
  • 举报
回复
把 grid_cell 换成 grid_cell2

你故意写了2个CLASS(grid_cell和grid_cell2),应该有一个是给空行用的。
你第一个空行用了grid_cell2,其他的全部用了grid_cell
为什么你第2个空行不用grid_cell2呢?我纳闷。。
调皮的蟠桃 2009-07-14
  • 打赏
  • 举报
回复
学习了!
fczwdyq 2009-07-06
  • 打赏
  • 举报
回复
把是黑线的单元格或表格设置border=0如:<td border="0"></td>或<table border="0"></table>
ZhaoHuiZiXin 2009-07-06
  • 打赏
  • 举报
回复
.grid_cell{
border-top-color:#ffffff;
border-left-color:#ffffff;
border-right-color:#808080;
border-bottom-color:#808080;
border-top-style:solid;
border-left-style:solid;
border-right-style:solid;
border-bottom-style:solid;
border-top-width:0px;
border-left-width:0px;
border-right-width:0px;
border-bottom-width:0px;
color:#000FFF;
background-color: #FFFFFF;
font-size:0px;
text-align:center;
vertical-align:middle;
font-family:"宋体";
cursor:default;
width:51px;
height:20px;
white-space:nowrap;
border-collapse:collapse;
padding:0px;
margin:0px;
text-overflow:ellipsis;
}

把 border-top-width:0px;
border-left-width:0px;
border-right-width:0px;
border-bottom-width:0px;
边框的宽度设置为 0.
ZhaoHuiZiXin 2009-07-06
  • 打赏
  • 举报
回复
.web_table {
border:0px solid #C8C8C8;
-moz-user-select: none;
z-index: 0;
table-layout:fixed;
border-spacing:0px;
border-collapse:collapse;
width:0px;
height:0px;
padding:0px;
margin:0px;
}
你那个 table 引用了这个样式, border: 0px; 就可以啦.
shfzhzhr 2009-07-06
  • 打赏
  • 举报
回复
[Quote=引用 21 楼 Rambo_8 的回复:]
border:none;
[/Quote]
已经设置border:none;了:

<tr style="height:0px;line-height:0px;font-size:0px;border:none;">
<td class='grid_cell' style="height:0px;line-height:0px;font-size:0px;border:none;"> </td>
<td class='grid_cell' style="height:0px;line-height:0px;font-size:0px;border:none;"> </td>
<td class='grid_cell'style="height:0px;line-height:0px;font-size:0px;border:none;"> </td>
<td class='grid_cell' style="height:0px;line-height:0px;font-size:0px;border:none;"> </td>
<td class='grid_cell' style="height:0px;line-height:0px;font-size:0px;border:none;"> </td>
<td class='grid_cell' style="height:0px;line-height:0px;font-size:0px;border:none;"> </td>
</tr>


Rambo_8 2009-07-06
  • 打赏
  • 举报
回复
border:none;
加载更多回复(20)

61,128

社区成员

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

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