提高 css3 文本旋转质量
我使用 CSS3 创建了一系列圆形选项卡。然后我旋转了这些选项卡,但文本的质量(Windows - Chrome)很差,并且在转换时也“变暗/模糊”。有哪些替代方案?我是否正确应用了 CSS?我最好旋转选项卡并保持文本水平吗?
I've created a series of rounded tabs using CSS3. I've then rotated these tabs, but the quality of the text (Windows - Chrome) is poor and also 'dims/blurs' on transition. What are the alternatives? Have I applied my CSS correctly? Would I be better to rotate the tabs and keep the text horizontal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(2)
Chrome
Chrome 默认不启用抗锯齿功能。但是您可以将此 CSS 属性添加到您的元素中以启用它:
这将强制浏览器使用其硬件加速来计算变换,这将添加一些抗锯齿功能作为奖励。
通过将
-webkit-backface-visibity
设置为hidden
也可以应用相同的效果:这是更新的 jsfiddle(在 Chrome 中测试)
http://jsfiddle.net/9eGt3/6/
Firefox
Firefox 默认启用抗锯齿功能,因此不需要使用任何transform3d hack必需的,但抗锯齿算法的质量因浏览器版本而异。以下是一些比较图像:
分别是 Firefox 5、Firefox 9 和 Chrome。
这里最好的选择是调整字体,使其对抗锯齿算法更加友好。在这种情况下,选择更粗更大的字体可能会有所帮助。
Chrome
Chrome doesn't enable anti-aliasing by default. But you can add this CSS property to your elements in order to enable it:
This will force the browser to use its hardware acceleration to calculate the transforms, which will add some anti-aliasing as a bonus.
The same effect could also be applied by setting the
-webkit-backface-visibity
tohidden
:Here is your updated jsfiddle (tested in Chrome)
http://jsfiddle.net/9eGt3/6/
Firefox
Firefox enables anti-aliasing by default so no transform3d hack is required, but the quality of the anti-aliasign algorithm varies among the browser version. Here are some comparison images:
Those are Firefox 5, Firefox 9 and Chrome respectively.
Your best bet here is to tweak your font in order to make it more friendly to the anti-aliasing algorithm. In this case, choosing a bolder and bigger font might help.
正如我提到的,使用 javascript 可能会使过渡更加平滑,而不会破坏文本或边框。用这个替换 CSS 过渡似乎有很大帮助。这是使用 jQuery - 当然使用您选择的工具:
http://jsfiddle.net/9eGt3/5/
我不太幸运能够经常使用 CSS3,所以这不是我的专业领域 - 但不幸的是我不得不删除现有的 CSS 悬停过渡才能让它工作。您可以使用 JavaScript 检测技术来回退到 CSS 转换,例如将
class="js-enabled"
添加到 body 标记(当然使用 js)并在 CSS 选择器中使用它。除此之外,我认为除非您想使用图像(呸)或者再等几年直到浏览器可以更好地处理这些东西(grr),否则您已经筋疲力尽了。不要将此视为福音,有人可能会为您提供解决方案 - 但我想我至少会提供一个解决方法。
As I alluded to, using javascript might make the transition smoother, without disrupting the text or borders. Replacing the CSS transitions with this seemed to help greatly. This is using jQuery - use the tool of your choice of course:
http://jsfiddle.net/9eGt3/5/
I'm not lucky enough to be able to use CSS3 very often, so this is not an area of expertise for me - but I unfortunately had to remove the existing CSS hover transitions to get it to work. You might use a javascript detection technique to fall back to CSS transtitions, like by adding
class="js-enabled"
to the body tag (with js of course) and using that in your CSS selector.Outside of that, I think you're out of gas unless you want to use images (bah) or wait a few more years until browsers can handle this stuff a little better (grr). Don't take this as gospel, someone might have a solution for you - but I thought I'd at least offer a workaround.