【发布时间】:2012-03-06 18:31:17
【问题描述】:
我正在尝试使用以下 javascript/jquery 代码将表 (templtableselect) 中第 th 元素的高度设置为与另一个表 (templtable) 中第 th 元素的高度相同:
var thheight = $('table#templtable th').css("height");
$('table#templtableselect th').css({"height":thheight, "border":"0px"});
在 chrome 中一切正常,但在 Firefox 中存在 1 个像素的差异。我也尝试了 .height() 函数,但结果相同。
当我用firebug分析firefox中的元素时,结果如下:
Templtable
size 105 x 34
border 1
Templtableselect
size 44 x 33
border 1
您也可以看到相同的 1 个像素的差异。
知道什么会导致这种差异吗?
谢谢
【问题讨论】:
-
请提供一些代码(HTML + CSS)。我无法重现此问题。 Firebug 为两个表头显示 100px:jsfiddle.net/tLnTU
标签: jquery css firefox google-chrome height