css rotate a pseudo :after or :before content:“”

前端 未结 2 1938
北荒
北荒 2020-11-29 22:44

anyway to make a rotation work on the pseudo

content:\"\\24B6\"? 

I\'m trying to rotate a unicode symbol.

2条回答
  •  忘掉有多难
    2020-11-29 23:13

    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;
      -webkit-transform: rotate(30deg);
      -moz-transform: rotate(30deg);
      -o-transform: rotate(30deg);
      -ms-transform: rotate(30deg);
      transform: rotate(30deg);
    }
    Some text

提交回复
热议问题