Javascript 如何防止td中的文本破坏我的表';什么是路线?

Javascript 如何防止td中的文本破坏我的表';什么是路线?,javascript,jquery,html,Javascript,Jquery,Html,我一直在研究一个只有jQuery的可滚动tbody表,唯一的问题是:每次文本比其他文本大或小时,我的thead和tbody都会出错,我如何防止它这样做 可滚动的tbody正在工作,只是对齐不太正确: 右侧: +-----------+ | h | h | h | -> Header is okay if all THs are about the same size |¨¨¨¨¨¨¨¨¨¨¨| | c | c | c | -> Same thing applies to the tb

我一直在研究一个只有jQuery的可滚动tbody表,唯一的问题是:每次文本比其他文本大或小时,我的thead和tbody都会出错,我如何防止它这样做

可滚动的tbody正在工作,只是对齐不太正确:

右侧:

+-----------+
| h | h | h | -> Header is okay if all THs are about the same size
|¨¨¨¨¨¨¨¨¨¨¨|
| c | c | c | -> Same thing applies to the tbody 
+-----------+
|hasd| h | h| -> if the texts are different sizes the fields get screwed up
|¨¨¨¨¨¨¨¨¨¨¨|
| c |casd |c| -> Same thing applies to the tbody 
问题:

+-----------+
| h | h | h | -> Header is okay if all THs are about the same size
|¨¨¨¨¨¨¨¨¨¨¨|
| c | c | c | -> Same thing applies to the tbody 
+-----------+
|hasd| h | h| -> if the texts are different sizes the fields get screwed up
|¨¨¨¨¨¨¨¨¨¨¨|
| c |casd |c| -> Same thing applies to the tbody 
我的代码:

+-----------+
| h | h | h | -> Header is okay if all THs are about the same size
|¨¨¨¨¨¨¨¨¨¨¨|
| c | c | c | -> Same thing applies to the tbody 
+-----------+
|hasd| h | h| -> if the texts are different sizes the fields get screwed up
|¨¨¨¨¨¨¨¨¨¨¨|
| c |casd |c| -> Same thing applies to the tbody 
$(函数(){
使其可滚动();
});
$(窗口)。调整大小(函数(){
使其可滚动();
});
函数makeItScrollable(){
$('table').css({
“边界塌陷”:“塌陷”
});
$('thead').css({
“位置”:“绝对”,
“宽度”:“100%”
});
$('tbody').css({
“位置”:“绝对”,
“溢出y”:“滚动”,
“溢出-x”:“隐藏”,
“高度”:“100%”
});
$('tbody').css({
“宽度”:Math.ceil($('thead').width()+17)
});
$('tbody>tr>td').css({
“宽度”:Math.ceil($('thead').width())
});
$('thead>tr>th').css({
'宽度':$('tbody').width()/$('thead>tr>th').length
});
$('tbody').css({
“页边距顶部”:$('thead')。高度()-1
});
}

.桌子{
位置:绝对位置;
宽度:计算(100%-30px);
高度:计算(100%-36px);
}
运输署,
th{
边框:1px实心#000;
文本对齐:居中;
保证金:0;
填充:0;
}
人头税
标题
标题
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞
细胞