固定表头的问题

tree_ch 2007-12-03 11:27:06
以下是我的代码,我把表头设计为固定的,但是在"ROWSPAN"的行里,字只显示一半?如果去除固定表头的代码,就正常显示了!
为什么啊???
拜求各位达人帮忙啊!

<html>
<head>
</head>
<body>
<DIV style="height:100%;width=700px;overflow:scroll">
<TABLE width=100% border=1>
<tR style="BACKGROUND-COLOR: #CAE4FF; POSITION: relative;TOP: expression(this.offsetParent.scrollTop);">
<td align="center" bgcolor="#CAE4FF" rowspan="2" >font color="#000000" size="2">姓名</font></td>
<td align="center" bgcolor="#CAE4FF" ><font color="#000000" size="2">目标</font></td>
</TR>
<tR style="BACKGROUND-COLOR: #CAE4FF; POSITION: relative;TOP: expression(this.offsetParent.scrollTop);">
<td align="center" bgcolor="#CAE4FF" ><font color="#000000" size="2">实际</font></td>
</TR>
<tr>
<td align="center" bgcolor="#CAE4FF" rowspan=2 ><font color="#000000" size="2">John</font></td>
<td align="center" bgcolor="#CAE4FF" ><font color="#000000" size="2">30</font></td>
</tr>
<tR>
<td align="center" bgcolor="#CAE4FF" ><font color="#000000" size="2">25</font></td>
</TR>
<tr>
<td align="center" bgcolor="#CAE4FF" rowspan=2 ><font color="#000000" size="2">Mary</font></td>
<td align="center" bgcolor="#CAE4FF" ><font color="#000000" size="2">32</font></td>
</tr>
<tR>
<td align="center" bgcolor="#CAE4FF" ><font color="#000000" size="2">28</font></td>
</TR>
</TABLE>
</div>
</body>
</html>
...全文
82 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yixianggao 2007-12-03
  • 打赏
  • 举报
回复
自己再微调吧!
<html>
<head></head>
<body>
<div style="height: 150px; width: 700px; overflow: scroll">
<table width="100%" border="1">
<tr style="background-color: #CAE4FF; position: relative; top: expression(this.offsetParent.scrollTop);">
<td colspan="2">
<table width="100%" border="1">
<tr>
<td align="center" bgcolor="#ffff00" rowspan="2">
<font color="#000000" size="2">姓名</font>
</td>
<td align="center" bgcolor="#CAE4FF">
<font color="#000000" size="2">目标</font>
</td>
</tr>
<tr style="background-color: #CAE4FF;">
<td align="center" bgcolor="#CAE4FF">
<font color="#000000" size="2">实际</font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" bgcolor="#ffffff" rowspan="2">
<font color="#000000" size="2">John</font>
</td>
<td align="center" bgcolor="#CAE4FF">
<font color="#000000" size="2">30</font>
</td>
</tr>
<tr>
<td align="center" bgcolor="#CAE4FF">
<font color="#000000" size="2">25</font>
</td>
</tr>
<tr>
<td align="center" bgcolor="#CAE4FF" rowspan="2">
<font color="#000000" size="2">Mary</font>
</td>
<td align="center" bgcolor="#CAE4FF">
<font color="#000000" size="2">32</font>
</td>
</tr>
<tr>
<td align="center" bgcolor="#CAE4FF">
<font color="#000000" size="2">28</font>
</td>
</tr>
</table>
</div>
</body>
</html>
飘零雾雨 2007-12-03
  • 打赏
  • 举报
回复
only ie

参考:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Layout</title>
<style type="text/css">
html,body {
margin:0;
font:12px/180% Verdana, Arial;
text-align:center;
}
div {
margin:50px auto 0 auto;
width:500px;
height:110px;
overflow:auto;
}
table {
border:none;
background:#000;
}
tr {
background:#fff;
}
th,td {
padding:0;
}
th {
background:#f7f7f7;
}
.id {
width:100px;
}
.name {
width:200px;
}
.age {
width:200px;
}
thead tr {
position:relative;
top:0;
background:#000;
}
</style>
</head>
<body>
<div>
<table cellspacing="1">
<thead>
<tr>
<th class="id">ID</th>
<th class="name">姓名</th>
<th class="age">年龄</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>张三</td>
<td>24</td>
</tr>
<tr>
<td>2</td>
<td>李四</td>
<td>32</td>
</tr>
<tr>
<td>1</td>
<td>张三</td>
<td>24</td>
</tr>
<tr>
<td>2</td>
<td>李四</td>
<td>32</td>
</tr>
<tr>
<td>1</td>
<td>张三</td>
<td>24</td>
</tr>
<tr>
<td>2</td>
<td>李四</td>
<td>32</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>

61,128

社区成员

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

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