CSS像素可以是分数吗? [英] Can a CSS pixel be a fraction?
问题描述
CSS px
可以是小数吗?是否被标准允许?
Can a CSS px
be a fraction? Is it allowed by the standards? And if so, do the major browsers support it?
推荐答案
>解决方案
是的,您可以指定分数像素。因为这是自第一个版本以来的CSS的一部分,它应该完全支持任何支持CSS的浏览器。
Yes, you can specify fractional pixels. As this has been part of CSS since the very first version, it should be well supported by any browser that supports CSS at all.
参考: CSS 2.1:4.3.2长度
长度值的格式(在此
规范中由< length>表示)是一个< number>(带或不带小数点)$ b $
"The format of a length value (denoted by <length> in this specification) is a <number> (with or without a decimal point) immediately followed by a unit identifier (e.g., px, em, etc.)."
当元素显示在屏幕上时,大多数浏览器会将位置自然舍入到最接近的像素。
When the elements are displayed on the screen, most browsers will naturally round the position to the nearest pixel.
这篇关于CSS像素可以是分数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!