Font Awesome is a, well, awesome tool that gives developers free access to hundreds of different useful icons to add to their sites and web apps. It’s becoming a really nice alternative to downloading PSD icon sets, largely because since the icons are HTML elements, they can be completely manipulated (color, size, positioning) using CSS. They’re much more dynamic than .jpegs and .pngs.
Font Awesome has icons for every occasion, but the ones I find myself using most often are the ones that correspond to different social media platforms. Making those popular social media button icons is SO easy using Font Awesome and CSS — no photoshop required.
To start using Font Awesome, make sure you’ve got their library loaded either on your server or by lining to the Font Awesome CDN either in the head of your HTML or at the top of your stylesheets using @import, like this:
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
For the purposes of this tutorial, let’s use one of the more popular social media sites as our example: Facebook. Font Awesome has a few different Facebook icons that you an utilize (check out all their icons here).
To add the icon to your site, you’ll need to place the following HTML code wherever you’d like the Facebook icon to show up on your page(s).
Each Font Awesome Icon has its own corresponding class, which you can look up on its individual page on Font Awesome’s site. Here’s what the Facebook icon looks like before we apply any styling to it:
Let’s add some CSS:
- border-radius: 100%;
- font-size: 28px;
- height: 38px;
- line-height: 40px;
- margin: 5px;
- text-align: center;
- width: 38px;
- border: 1px solid #3B5998;
- color: #3B5998;
Because the icon is an HTML element, it responds to styling just like any other HTML element, so using CSS, we can apply the signature Facebook blue, we can add a border-radius to make the element round and add a nice, clean border as well. We can play around with the margins, the size of the element, and the size of the icon (which can be adjusted using font-size). We can even add some hover styles and CSS transitions much more easily than if we were working with an image rather than an HTML element. Using icons like these over images makes it a lot easier for developers to get creative using CSS.