[英]Subpixel and letter-spacing
I would like to use letter-spacing
on my headings.我想在标题上使用
letter-spacing
。 The headings are responsive: at smaller screen sizes, the headings have a smaller font-size
.标题是响应式的:在较小的屏幕尺寸下,标题的
font-size
较小。 Therefore it makes sense to use em
for the letter-spacing measurement.因此,使用
em
进行字母间距测量是有意义的。
I've noticed that this results in subpixle letter-spacing
.我注意到这会导致 subpixle
letter-spacing
。 It appears fine in Firefox, Chrome and Safari on my Mac, but will it work across all browsers?它在我的 Mac 上的 Firefox、Chrome 和 Safari 中看起来很好,但它可以在所有浏览器上运行吗? Or will some (older) browsers round to the nearest pixel?
或者一些(旧的)浏览器会四舍五入到最近的像素吗?
I want to avoid browsers rounding down to zero - therefore ignoring the letter-spacing.我想避免浏览器四舍五入到零 - 因此忽略字母间距。 Or rounding up to 1 and the letter-spacing being too loose.
或者四舍五入到 1 并且字母间距太松。
I read this post from several years ago, which implies browsers rounded subpixles Web-Kit and sub-pixel values, workaround?我几年前读过这篇文章,这意味着浏览器舍入了子像素 Web-Kit 和子像素值,解决方法?
h1 {
font-size:7.2rem; /* equals 72px */
letter-spacing:0.01em; /* equals 0.72px */
}
经过更多研究,现代浏览器似乎确实支持子像素字母间距,请参阅https://css-tricks.com/almanac/properties/l/letter-spacing/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.