Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transform 与 inline 元素的关系 #118

Open
lovelmh13 opened this issue Jul 23, 2021 · 0 comments
Open

transform 与 inline 元素的关系 #118

lovelmh13 opened this issue Jul 23, 2021 · 0 comments

Comments

@lovelmh13
Copy link
Owner

使用 transform 的时候,部分 inline 元素不会生效。

transform 对于可替换元素是生效的

一下说明了有哪些 inline 元素可以有效的使用 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].

翻译:

可转换元素是这些类别中的一个元素。
元素的布局由 CSS box 模型控制,该模型是块级或原子内联级元素,或其显示属性为 table-row、table-row-group、table-header-group、table-footer-group、table-cell或table-caption [CSS21] 。
SVG 命名空间中的元素,不受CSS盒子模型的约束,其属性为 transform、'patternTransform' 或 gradientTransform [SVG11]。

We should note that not all the inline elements cannot be transformed but only the non-replaced inline elements thus the replaced inline elements can be transformed.

So basically we can apply transformation to img, canvas, etc without the need of making them inline-block or block

参考:

CSS transform doesn't work on inline elements

The Transform Rendering Model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant