gpt4 book ai didi

css - 变换 :before or :after item

转载 作者:技术小花猫 更新时间:2023-10-29 11:28:51 29 4
gpt4 key购买 nike

有没有办法将转换应用到插入了 :before 的元素上?

以下方法无效,但我愿意接受其他解决方案。

.itemclass:before  {
content: "➨";
transform: rotate(30deg);
-ms-transform: rotate(30deg); /* IE 9 */
-webkit-transform: rotate(30deg); /* Safari and Chrome */
}

最佳答案

转换不能应用于非替换的 inline 元素。添加:

display:inline-block;

Demo

旁注:尽管这不适用于此用例,absolute/fixed 定位将不再需要 display属性,因为这些属性会被自动视为 display:block

此外,检查 transformable element 的定义:

A transformable element is an element in the HTML namespace 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’; or an element in the SVG namespace (see [SVG11]) which has the attributes ‘transform’, ‘patternTransform’ or ‘gradientTransform’.

关于css - 变换 :before or :after item,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16108346/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com