Changing Width of Font Awesome Icons

我们两清 提交于 2019-12-03 08:21:58

问题


I'm trying to adjust the scaling and width of an icon. I'm specifically trying to make the icon

<i class="fa fa-bars fa-lg"></i>

wider, but not taller.

I'm not trying to make it fa-2x or fa-3x. I'm trying to scale it so that the width is, say 150%, while the height is still 100%.


回答1:


Really easy using scale

.fa { transform: scale(1.5,1); }



回答2:


This answer only works when you are trying to adjust the icons in the list. But I am posting this because I guess some people visiting this page is in this situation.

If you are so applying "fa-fw" class to icons solves the problems.

Example from docs.

<div style="font-size: 2rem;">
  <div><i class="fas fa-skating fa-fw" style="background:DodgerBlue"></i> Skating</div>
  <div><i class="fas fa-skiing fa-fw" style="background:SkyBlue"></i> Skiing</div>
  <div><i class="fas fa-skiing-nordic fa-fw" style="background:DodgerBlue"></i> Nordic Skiing</div>
  <div><i class="fas fa-snowboarding fa-fw" style="background:SkyBlue"></i> Snowboarding</div>
  <div><i class="fas fa-snowplow fa-fw" style="background:DodgerBlue"></i> Snowplow</div>
</div>

Docs https://fontawesome.com/how-to-use/on-the-web/styling/fixed-width-icons



来源:https://stackoverflow.com/questions/28564793/changing-width-of-font-awesome-icons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!