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-* and fa-flip-* classes.
However, doing
<i class="fa fa-link fa-rotate-45" style="font-size:1.5em"></i>
does not work, whereas replacing fa-rotate-45
with fa-rotate-90
does. Does this mean that they in fact cannot rotate arbitrarily?
In case someone else stumbles upon this question and wants it here is the SASS mixin I use.
If you want to rotate 45 degrees, you can use the CSS transform property:
New Font-Awesome v5 has Power Transforms
You can rotate any icon by adding attribute
data-fa-transform
to iconHere is a fiddle
For more information, check this out : Font-Awesome5 Power Tranforms
If you use Less you can directly use the following mixin:
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: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 ofrotate-
and your desired rotation in degrees.Source: https://fontawesome.com/how-to-use/on-the-web/styling/power-transforms