一个Table问题:
我的要求是表头不动 内容跟着滚动条动
已经搜到的结果是:
给Table加DIV,并给表头加样式如:
tr {
position:relative;
background:#000;
}
这样 拉动滚条 表头就不动了! 效果也达到了!
接下来引发了新问题:
当我的Table里有 标签(我举个例子) 并给标签加了样式
如:a.fontbutton{......}
a.fontbutton:hover{......}
a.fontbutton:active{......}
详细
这样当滚条滚动后,再碰标签,表头就跑上面去了!
也就是表内容的样式一变,表头的位置就变了!
问题不知道描述清楚没有,这个问题我该怎么解决呢?
[color=brown]十分谢谢各位!!![/color]
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
div {
position:relative;
width:800px;
height:100px;
overflow-y:scroll;
}
thead tr {
position:relative;
background:#f0f0f0;
z-index:10;
top:expression(this.offsetParent.scrollTop-2);
}