Firefox 中的 CSS 高度差异
我正在尝试使用以下 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像素差异。
知道什么会导致这种差异吗?
谢谢
I am trying to set the height of a th element in a table (templtableselect) the same as the height of the th element in another table (templtable) using the following javascript/jquery code:
var thheight = $('table#templtable th').css("height");
$('table#templtableselect th').css({"height":thheight, "border":"0px"});
In chrome everything works fine, but in firefox there is 1 pixel difference. I also tried the .height() function, but that resulted in the same outcome.
When I analyse the elements in firefox with firebug the result is as following:
Templtable
size 105 x 34
border 1
Templtableselect
size 44 x 33
border 1
You can see the same difference of 1 pixel as well.
Any idea what can causes this difference?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
outerHeight()
代替,它将边框和填充添加到高度。Try using
outerHeight()
instead, it adds the border and padding to the height.