最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to change the direction of a font awesome icon? - Stack Overflow

programmeradmin3浏览0评论

I am using the font-awsome library to show a unlock icon .

So, By default the direction is in right direction, I want to change that to the left.

<i class="fas fa-unlock-alt"></i>

SO, is there any way through which I can change the direction of the unlock icon ?

I am using the font-awsome library to show a unlock icon .

So, By default the direction is in right direction, I want to change that to the left.

<i class="fas fa-unlock-alt"></i>

SO, is there any way through which I can change the direction of the unlock icon ?

Share Improve this question edited Jun 5, 2019 at 8:51 Temani Afif 273k28 gold badges364 silver badges483 bronze badges asked Jun 5, 2019 at 8:42 ganesh kaspateganesh kaspate 2,68512 gold badges51 silver badges104 bronze badges 2
  • 2 fa-flip-horizontal – Thomas Commented Jun 5, 2019 at 8:46
  • 1 BTW you can use css(in case you won't use font-awesome and you want to change direction) with transform: scaleX(-1) :jsfiddle/29ctojxb – לבני מלכה Commented Jun 5, 2019 at 8:56
Add a ment  | 

3 Answers 3

Reset to default 9

You can use the fa-flip-horizontal class as documented here.

<link href="https://cdnjs.cloudflare./ajax/libs/font-awesome/5.8.2/css/all.min.css" rel="stylesheet"/>

<i class="fas fa-unlock-alt"></i>
<i class="fas fa-unlock-alt fa-flip-horizontal"></i> 

You can rotate and flip icons with font awesome. In your case you can try this:

<i class="fas fa-unlock-alt fa-flip-horizontal"></i>

Check out this link for more information https://fontawesome./how-to-use/on-the-web/styling/rotating-icons

Considering the JS+SVG version you can use flip-h to flip the icon horizontally

<script defer src="https://use.fontawesome./releases/v5.8.1/js/all.js"></script>

<i class="fas fa-unlock-alt" data-fa-transform="flip-h"></i>

More details: https://fontawesome./how-to-use/on-the-web/styling/power-transforms

发布评论

评论列表(0)

  1. 暂无评论