Statically rotate font-awesome icons

后端 未结 6 1088
说谎
说谎 2021-01-30 06:19

I\'d like to statically rotate my font-awesome icons by 45 degrees. It says on the site that:

To arbitrarily rotate and flip icons, use the fa-rotate-* an

6条回答
  •  花落未央
    2021-01-30 06:45

    Before FontAwesome 5:

    The standard declarations just contain .fa-rotate-90, .fa-rotate-180 and .fa-rotate-270. However you can easily create your own:

    .fa-rotate-45 {
        -webkit-transform: rotate(45deg);
        -moz-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
        -o-transform: rotate(45deg);
        transform: rotate(45deg);
    }
    

    With FontAwesome 5:

    You can use what’s so called “Power Transforms”. Example:

    
    
    
    
    
    

    You need to add the data-fa-transform attribute with the value of rotate- and your desired rotation in degrees.

    Source: https://fontawesome.com/how-to-use/on-the-web/styling/power-transforms

提交回复
热议问题