CSS “transform: rotate()” affecting overall design with “position: absolute” (not aligning properly)

不打扰是莪最后的温柔 提交于 2019-12-03 12:34:14

This happens because the nav element has different width and height. By default an element is rotated by its centre, so in case of your nav the corners of this block after rotation don't match. The solution to this problem is to set the transform-orgin property that will move the rotation point so that the bottom left corners before and after transformation are in the same place. In your case it's transform-origin: 75px 75px; (works independently of the <a> length).

Here's the fiddle

Unfortunately it won't solve the problem for IE8- as those browsers doesn't support transformation and use their own way of rotating things.

It seems to be the padding of the ul in your nav. Try to fine-tune

nav ul { padding-left: 0; }

(Chrome's dev-tools might help you to find the missing last 1 or 2 pixels, helped me to find the ul padding.)

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