简体   繁体   English

CSS3旋转 - 在Firefox和Safari中呈现问题

[英]CSS3 rotate - rendering problems in Firefox and Safari

I'm trying to rotate a simple line of text by some degrees with the CSS3 property »rotate«, precisely by 1.5 degrees. 我正在尝试使用CSS3属性»旋转«旋转一段简单的文本,精确度为1.5度。

  -webkit-transform: rotate(1.5deg);
  -moz-transform: rotate(1.5deg);
  -ms-transform: rotate(1.5deg);
  -o-transform: rotate(1.5deg);
  transform: rotate(1.5deg);

The result in Chrome (v18) is looking OK, in Firefox (v10) and Safari (5.1.5) however I am getting ugly results. Chrome(v18)的结果看起来不错,在Firefox(v10)和Safari(5.1.5)中,但是我的结果很难看。

I am using a font implemented with @font-face, but with Arial i still get problems (at least in Firefox). 我使用的是使用@ font-face实现的字体,但是使用Arial我仍然会遇到问题(至少在Firefox中)。 See examples below. 见下面的例子。

What's really weird is that switching to a system font (Arial) in Safari resolves the problem, while in Firefox the problem persists. 真正奇怪的是,在Safari中切换到系统字体(Arial)可以解决问题,而在Firefox中问题仍然存在。

Any help, workaround or hack would be greatly appreciated. 任何帮助,解决方法或黑客将不胜感激。

1) Chrome 18 / font-family: Calibri / alignment OK 1)Chrome 18 / font-family:Calibri / alignment OK

2) Firefox 10 / font-family: Calibri / alignment ugly 2)Firefox 10 / font-family:Calibri / alignment丑陋

3) Firefox 10 / font-family: Arial / alignment still ugly 3)Firefox 10 / font-family:Arial / alignment仍然很难看

4) Safari 5.1.5 / font-family: Calibri / alignment ugly 4)Safari 5.1.5 / font-family:Calibri / alignment丑陋

5) Safari 5.1.5 / font-family: Arial / alignment OK 5)Safari 5.1.5 / font-family:Arial / alignment OK

So far, I have found the following threads, but none of them gives an explanation on how to solve the problem: 到目前为止,我已经找到了以下线程,但没有一个给出如何解决问题的解释:

https://bugzilla.mozilla.org/show_bug.cgi?id=403447 https://bugzilla.mozilla.org/show_bug.cgi?id=403447

CSS3 Bugs - Issues when using transform:rotate rules (Safari + Firefox) CSS3错误 - 使用转换时的问题:旋转规则(Safari + Firefox)

CSS Transform Rotate letter alignment CSS变换旋转字母对齐

I have also tried setting the DirectWrite variables (to change font rendering), as described in this tutorial: http://www.askvg.com/how-to-enable-direct2d-directwrite-hardware-acceleration-in-mozilla-firefox/ , but the results are the same. 我也尝试过设置DirectWrite变量(以更改字体渲染),如本教程中所述: http//www.askvg.com/how-to-enable-direct2d-directwrite-hardware-acceleration-in-mozilla-firefox / ,但结果是一样的。

This isn't something that you can fix, from the bug report and other bits it looks like the browser makers are aware of these problems.. but I wouldn't hold out for a permanent fix for a while. 这不是你可以修复的东西,从错误报告和浏览器制造商看到这些问题的其他位看起来......但我暂时不会坚持永久修复。

Maybe try putting the text in its own div container and rotating that instead of the text directly? 也许尝试将文本放在自己的div容器中并直接旋转而不是文本?

But IMHO if you need this to work on a production site, replace the text with an image. 但恕我直言,如果你需要这个在生产网站上工作,用图像替换文本。 Users are using browsers that don't support the new CSS3 stuff so if it's important either don't use it, or ensure it degrades nicely (functional on all platforms, but may loose some snazz) ie disable the text rotation on the browsers that look ugly. 用户正在使用不支持新CSS3内容的浏览器,所以如果重要的是要么不使用它,要么确保它很好地降级(在所有平台上都可用,但可能会丢失一些snazz),即禁用浏览器上的文本轮换看起来很难看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM