Make all your icons the same width so they can easily vertically align, like in a list or navigation menu.
Add a class of fa-fw
on the HTML element referencing your icon to set one or more icons to the same fixed width. This is great to use when varying icon widths (e.g. a tall but skinny icon atop a wide but short icon) would throw off vertical alignment. For clarity in the following example, we’ve added a background color on the icon so you can see the fixed width and also bumped up the font-size of the parent element.
<!-- vertically aligning icons -->
< div style = "font-size: 2rem;" >
< div >< i class = "fa-solid fa-skating fa-fw" style = "background:DodgerBlue" ></ i > Skating</ div >
< div >< i class = "fa-solid fa-skiing fa-fw" style = "background:SkyBlue" ></ i > Skiing</ div >
< div >< i class = "fa-solid fa-skiing-nordic fa-fw" style = "background:DodgerBlue" ></ i > Nordic Skiing</ div >
< div >< i class = "fa-solid fa-snowboarding fa-fw" style = "background:SkyBlue" ></ i > Snowboarding</ div >
< div >< i class = "fa-solid fa-snowplow fa-fw" style = "background:DodgerBlue" ></ i > Snowplow</ div >
Setting a Consistent Icon Width
Font Awesome icons are designed on grid and share a consistent height. But
they vary in width depending on how wide or narrow each symbol is. If you
prefer to work with icons that have a consistent width, adding fa-fw
will
render each icon using the same width.
<!-- setting all icons used in buttons to have the same width using fa-fw -->
< span style = "display: inline-block; margin: 0.25em; border: 1px solid silver; border-radius: 0.25em; padding: .25em 0.5em" >< i class = "fa-solid fa-arrow-left fa-fw" title = "Back" ></ i ></ span >
< span style = "display: inline-block; margin: 0.25em; border: 1px solid silver; border-radius: 0.25em; padding: .25em 0.5em" >< i class = "fa-solid fa-arrow-right fa-fw" title = "Forward" ></ i ></ span >
< span style = "display: inline-block; margin: 0.25em; border: 1px solid silver; border-radius: 0.25em; padding: .25em 0.5em" >< i class = "fa-solid fa-arrows-rotate fa-fw" title = "Refresh" ></ i ></ span >
< span style = "display: inline-block; margin: 0.25em; border: 1px solid silver; border-radius: 0.25em; padding: .25em 0.5em" >< i class = "fa-solid fa-house fa-fw" title = "Home" ></ i ></ span >
< span style = "display: inline-block; margin: 0.25em; border: 1px solid silver; border-radius: 0.25em; padding: .25em 0.5em" >< i class = "fa-solid fa-info fa-fw" title = "Info" ></ i ></ span >
< span style = "display: inline-block; margin: 0.25em; border: 1px solid silver; border-radius: 0.25em; padding: .25em 0.5em" >< i class = "fa-solid fa-download fa-fw" title = "Download" ></ i ></ span >