1. 程式人生 > >transform失效了?iconfont字型圖示無法旋轉,無法縮放?的解決辦法

transform失效了?iconfont字型圖示無法旋轉,無法縮放?的解決辦法

其實只要是 transform 性的內容運用在 iconfont 圖示上都是無效的

原因

查參考手冊,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].

 解決方案:

既然 transform 不適用於某些內聯元素,那咱們就把這些元素變成 inline-blockblock 就行了。