在CSS中使用小数/小数像素作为边框是否明智? [英] Is it wise to use fractional / decimal pixels for borders in css?
问题描述
我的设计中有许多需要
border-right: 1.5px solid black;
border-bottom: 1.5px solid black;
等...
我的设计也需要更细的线:在1px
.
I also have design that needs thinner lines: at 1px
.
但是,似乎浏览器可能会将小数点后一位四舍五入,因为我发现两者之间没有太大区别(如果有的话).
However, it seems the browser may round the decimal, as I'm not seeing much differentiation between the two (if any).
我应该只使用2px
和1px
,还是有更好的方法实现这一目标?
Should I just be using 2px
and 1px
instead, or is there a better way to pull this off?
我正在帮助的设计师对1.5px
线宽非常坚定.
A designer I'm helping is very adamant about the 1.5px
line width.
任何帮助,不胜感激.
Any help, much appreciated.
推荐答案
您可以使用它,但是大多数浏览器会舍入像素值.
You can use it, but most browsers will round pixel value.
http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#values
http://ejohn.org/blog/sub-pixel-problems -in-css
http://cruft.io/posts/percentage-calculations-in-ie /
Remember that one CSS pixel is not always equal to one physical screen pixel: A pixel is not a pixel is not a pixel
这篇关于在CSS中使用小数/小数像素作为边框是否明智?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!