浮点长度值对像素单位有意义吗? [英] Does floating point length value make sense on pixel unit?

查看:568
本文介绍了浮点长度值对像素单位有意义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试为:


px':pixels; 1 px 等于


$中的1 / 96th b
$ b

13.1px 将与 0.1364in 相同,其中 13px 0.1354in



这就是说,你应该使用我的意见中的相对值,而 pt 表示整体底座尺寸。


When I try write stylish CSS for forums.asterisk.org site, I saw they use floating point length value on pixel unit, for example: font-size: 13.1px;.

As far as I known, pixel is the smallest unit in screen, so does floating point length value make sense on pixel unit?

Screenshot

解决方案

It's fine, the CSS recommendation allows numbers (not only integers) as values for pixels. Note that px is actually defined in terms of in in the recommendation:

‘px’: pixels; 1px is equal to 1/96th of 1in

All in all 13.1px will be the same as 0.1364in, where 13px would be 0.1354in. The difference is small, but noticeable.

That being said, you should use relative values in my opinion instead, and pt for the overall base size.

这篇关于浮点长度值对像素单位有意义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆