在CSS中使用小数/小数像素作为边框是否明智? [英] Is it wise to use fractional / decimal pixels for borders in css?

查看:197
本文介绍了在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).

我应该只使用2px1px,还是有更好的方法实现这一目标?

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 /

编辑:请记住,一个CSS像素并不总是等于一个物理屏幕像素:

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屋!

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