Search code examples
cssfont-awesomefont-awesome-5

Font Awesome 5 - Inversion of the icon position


Do you know a solution to reverse the position of an icon please?

enter image description here

I have found a solution, however I don't understand the properties.

-webkit-transform: scaleX(-1);
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";

I am looking for a solution simple...

.fa{
font-size: 23px;
color: blue;
margin-right: 10px;
-webkit-transform: scaleX(-1);
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">

<div class="subtitle-right"><i class="fa fa-phone"></i>+(11)123 456 7890,</div>


Solution

  • An easy solution would be to consider the styling already provided by Font Awesome (https://fontawesome.com/how-to-use/on-the-web/styling/power-transforms)

    .fa-phone{
      font-size: 23px;
      color: blue;
      margin-right: 10px;
    }
    <script  src="https://use.fontawesome.com/releases/v5.7.2/js/all.js"></script>
    
    <div class="subtitle-right"><i class="fas fa-phone"></i>+(11)123 456 7890,</div>
    
    <div class="subtitle-right"><i class="fas fa-phone" data-fa-transform="flip-h"></i>+(11)123 456 7890,</div>