Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to rotate AND flip an icon?

Tags:

font-awesome

I am using the fa-bar-chart icon, but I'd like to have the lines going from left-to-right with the x & y axis starting in the bottom left corner.

I thought I could pair both 'fa-rotate-90' and 'fa-flip-horizontal' to get there, but combining the two does not work:

<div>
<i class="fa fa-bar-chart"></i> normal<br>
<i class="fa fa-bar-chart fa-rotate-90"></i> fa-rotate-90<br>
<i class="fa fa-bar-chart fa-flip-horizontal"></i> fa-flip-horizontal<br>
<i class="fa fa-bar-chart fa-rotate-90 fa-flip-horizontal"></i> fa-rotate-90 AND fa-flip-horizontal<br>
</div>

https://jsfiddle.net/virtusts/Lmtdk5ot/

Any suggestions?

like image 609
Dan Avatar asked Jun 01 '17 12:06

Dan


People also ask

Is there a way to rotate an icon?

Our SVG + JS framework includes a power transforms feature that allows for rotating an icon on a more granular scale, even by a single degree! If you're using Font Awesome that way, check it out.

How do I flip an icon in HTML?

Sign in . You can both rotate and flip an icon, but you'll need to use some extra markup, such as a <span> element, to do so as placing multiple rotate/flip classes on one element will just overwrite one another. Apply one rotate utility class on the parent element and another on the nested icon.

How do you flip an object in PowerPoint?

In PowerPoint, you can rotate or flip objects like text boxes, shapes, and pictures. Tap the object that you want to rotate. Select the rotation handle at the top of the object, and then drag in the direction that you want. To flip an object, select Drawing Tools > Rotate > Flip Vertical or Flip Horizontal.

How to flip an object in AutoCAD?

Select the rotation handle at the top of the object, and then drag in the direction that you want. To flip an object, select Drawing Tools > Rotate > Flip Vertical or Flip Horizontal. For more precise movement, select Drawing Tools > Rotate > More Rotation Options to see menu options.


2 Answers

Using the following CSS:

.fa-bar-chart {
  transform: rotate(90deg) scaleX(-1);
}

produces the desired outcome (bars left to right with left y axis).

Modified your JSFiddle to show the outcome.

like image 70
Sandman Avatar answered Sep 30 '22 04:09

Sandman


You can use this code for Flip :

.fa-flip-horizontal { 
  transform: scaleX(-1);
 }
like image 24
mohamad Avatar answered Sep 30 '22 03:09

mohamad