Text not in same position after rotating

三世轮回 提交于 2019-12-24 01:25:54

问题


After applying transform: rotate(90deg); the text is slightly shifted from it's normal position. Open this in Firefox: http://jsfiddle.net/42y89/. As you can see, the text appears shifted by 1px after it's rotated, which makes a big difference in this case. You can hover the boxes to see how this happens. On Chrome however it looks fine.

It seems related to the font-size / line-height / anti-aliasing? I don't know... does anyone have any ideas?

<div></div>


div { 
    width: 100px;
    height: 100px;
    margin: 25px;
    font: 60px/44px Arial, sans-serif;
    color: white;
    background: blue;
    text-align: center;
}

div + div {
    -webkit-transform: rotate(90deg);
    -moz-transform:    rotate(90deg);
    transform:         rotate(90deg);
}

来源:https://stackoverflow.com/questions/19353043/text-not-in-same-position-after-rotating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!