0

Possible Duplicate:
Are the decimal places in a CSS width respected?

Normally in CSS when we set a size we use while values in points or pixels. However, sometimes it is not possible to know the exact widths, so I jQuery to calculate it with .width() function and then perform some math, like divide by the number of elements etc.

Sometimes the results has decimal points. Do browsers support such values or is it better to round-up to whole values, for example using something like Math.floor(), before using the values?

4

1 回答 1

3

浏览器确实支持小数点,例如你可以有 20.5% 或 .5% 等

但是 - 这往往仅限于百分比,因为你不能真正拥有半个像素。

看,因为这基本上是重复的。

是否尊重 CSS 宽度中的小数位?

于 2012-09-24T18:27:40.850 回答