7 FONTAWESOME TRICKS YOU PROBABLY DIDN'T KNOW ABOUT
-
We’re sure you’re using the fantasic FontAwesome CSS library in all your web apps. Great icons and easy to use! But are you using all the tricks that make FontAwesome even easier to use? Check out these 7 FontAwesome tricks that you may not have spotted in the documentation.
1. You can increase the size of your FontAwesome icons automatically
The size of any FontAwesome icons you include in your HTML are always the same as the font-size specified for their container. So in order to get a bigger icon in relation to the text, you’d have to write something like this:
There’s a simpler approach! Just use the fa-lg (33% increase), fa-2x, fa-3x, fa-4x or fa-5x classes:
3. Use FontAwesome icons to replace unordered list bullets
Rather than laboriously writing CSS for removing the default bullets from unordered lists, then adding FontAwesome icons to serve as new bullets, which you would then make sure all have equal width, why not use the fa-ul class on your unordered list:
4. Use a FontAwesome icon as a pull quote icon marker
When you want to get big old 50px floating quote marks to indicate a quote in your text, you’re looking at 10 minutes of writing and debugging CSS. Why not use the fa-pull-left and fa-pull-right classes to float an icon before your quote text automatically? You can also add a border to it using the fa-border class.
Use the fa-spin class to get any icon to rotate, and use fa-pulse to have it rotate with 8 steps. Works well with fa-spinner, fa-refresh, and fa-cog. Be aware, though, that these CSS3 animations do not work in Internet Explorer 8 and 9.
7. Stack multiple FontAwesome icons on top of each other to create new ones (without writing any CSS)
To stack multiple icons, use the fa-stack class on the parent, the fa-stack-1x for the regularly sized icon, and fa-stack-2x for the larger icon. fa-inverse can be used as an alternative icon color. You can even throw larger icon classes on the parent to get further control of sizing.