css3中transform对行内元素(inline)无效?

        a{
            transition: all 0.1s ease-in;
        }
        a:hover{
            transform:rotate(10deg);
        }

预期效果是鼠标滑过,链接上的文字会有一个旋转的效果.
结果测试了几个浏览器都无效,
后来发现必须要把a元素设置为 display:inline-block
这是transform本身就对inline元素无效还是一个浏览器bug?

阅读 12.6k
2 个回答

参考手册链接
查参考手册,transform适用于:所有块级元素及某些内联元素

具体规则引用:

A transformable element is an element in one of these categories:
an element whose layout is governed by the CSS box model which is either a block-level or atomic inline-level element, or whose display property computes to table-row, table-row-group, table-header-group, table-footer-group, table-cell, or table-caption [CSS21]
an element in the SVG namespace and not governed by the CSS box model which has the attributes transform, ‘patternTransform‘ or gradientTransform[SVG11].

作者:顾轶灵
链接:https://www.zhihu.com/questio...
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

transform不支持inline

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题