css 旋转一个伪 :after 或 :before content:""

2022-01-16 00:00:00 rotation pseudo-element css

无论如何都要对伪进行旋转

anyway to make a rotation work on the pseudo

content:"24B6"? 

我正在尝试旋转一个 unicode 符号.

I'm trying to rotate a unicode symbol.

推荐答案

内联元素不能转换,伪元素默认是内联的,所以必须应用 display: blockdisplay: inline-block 来转换它们:

Inline elements can't be transformed, and pseudo elements are inline by default, so you must apply display: block or display: inline-block to transform them:

#whatever:after {
  content: "24B6";
  display: inline-block;
  transform: rotate(30deg);
}

<div id="whatever">Some text </div>

相关文章