开发者

How do I get the exact, floating point width of an element?

I am trying to get the exact width of a table cell. In IE9's developer toolbar, the Layout tab shows that it has a width of 203.68px, but element.clientWidth and other methods all report the rounded integer value of 204px.

I am trying to create another element that will line up perfectly with this table cell, but since IE8/9 (and Firefox 4 and Chrome 12) display the table cell at its true, floating point width (or perhaps semi-rounded, like 203.5px or 203.75px), my other element is slightly 开发者_Go百科wider.


Instead of trying to use the same exact width for the other element, you may want to consider changing your markup so these elements have some kind of direct relationship.

In case of td, it may be a td in a different column, or an inner element.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜