javascript 在 IE 中旋转文本,不会变得难看
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4899442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Rotate text in IE, without it getting ugly
提问by RemiX
I'd like to rotate a text by 90 degrees counter-clockwise. Firefox and Chrome are no problem, using:
我想将文本逆时针旋转 90 度。Firefox 和 Chrome 没有问题,使用:
-webkit-transform-origin: top left;
-webkit-transform: rotate(-90deg);
-moz-transform-origin: top left;
-moz-transform: rotate(-90deg);
For Internet Explorer, it should be this line, as far as I know:
对于 Internet Explorer,据我所知,应该是这一行:
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
(The other method, writing-mode, can only rotate text clockwise 90 degrees).
(另一种方法,writing-mode,只能将文本顺时针旋转 90 度)。
However, in IE the rotated text looks like a badly scaled image on its side (comparison below).
然而,在 IE 中,旋转的文本在其侧面看起来像一个严重缩放的图像(下面的比较)。
Firefox / Chrome -- vs -- Internet Explorer: 
Firefox / Chrome -- vs -- Internet Explorer: 
Is there any way that Internet Explorer can rotate the text in a more elegant way (possibly Javascript/jQuery)? I've been Googling, but I can only find more references to this method...
有什么办法可以让 Internet Explorer 以更优雅的方式(可能是 Javascript/jQuery)旋转文本?我一直在谷歌搜索,但我只能找到更多关于这种方法的参考......
采纳答案by swishmiller
回答by Dawson
It is Def the text rendering engine in IE; however, it's doable.
它是 IE 中的文本渲染引擎;然而,这是可行的。
filter:requires the element to have layout(ie. zoom). You can beat the rendering problem (most of the time), by giving the element a background color. Try the following on your example:
过滤器:要求元素具有布局(即缩放)。您可以通过为元素提供背景颜色来解决渲染问题(大多数情况下)。在您的示例中尝试以下操作:
zoom:1;
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
background-color:white;
回答by Barrie Reader
I would suggest either Google Fonts API or Cufon (as @swishmiller said), ordisabling Anti-Aliasing (ClearType) in IE so the fonts always look unsmoothed (is that a word)?
我建议使用 Google Fonts API 或 Cufon(如@swishmiller 所说),或者在 IE 中禁用抗锯齿(ClearType),这样字体总是看起来不平滑(这是一个词)?
Google Font API: http://code.google.com/webfonts
谷歌字体 API:http: //code.google.com/webfonts
Cufon: http://cufon.shoqolate.com/generate/
Cufon:http: //cufon.shoqolate.com/generate/
Disable ClearType:
禁用清除类型:
/* This will force IE into thinking there is a filter actually doing something, so it'll disable ClearType */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);
[edit]I should mention that I've not tried the Google Font API fix...
[编辑]我应该提到我没有尝试过谷歌字体 API 修复......
回答by mila
Try -ms-writing-mode property: http://msdn.microsoft.com/en-in/library/ie/ms531187%28v=vs.85%29.aspx
尝试 -ms-writing-mode 属性:http: //msdn.microsoft.com/en-in/library/ie/ms531187%28v=vs.85%29.aspx

