{"id":2568,"date":"2017-01-23T05:04:13","date_gmt":"2017-01-22T23:34:13","guid":{"rendered":"http:\/\/codetheory.in\/?p=2568"},"modified":"2017-01-23T05:04:13","modified_gmt":"2017-01-22T23:34:13","slug":"using-font-awesome-to-create-social-icons","status":"publish","type":"post","link":"https:\/\/codetheory.in\/using-font-awesome-to-create-social-icons\/","title":{"rendered":"Using Font Awesome to Create Social Icons"},"content":{"rendered":"

Font Awesome<\/a> is a really useful tool that provides developers with free access to hundreds of different icons and symbols to use in the projects in place of images and pngs. The great thing about using Font Awesome icons is that because they’re technically characters instead of images, the colors and sizes of the characters can easily be customized using CSS style rules. You can even really easily add hover effects and styling for active and visited states by using the CSS pseudo elements (:hover, :active, :visited).<\/p>\n

One really great way to take advantage of these Font Awesome icons is by using them to create social media icons — you know, those buttons you’ll find on almost every site that links to a site’s social media presences. Usually these are created in photoshop and uploaded to a server, but if you’re planning on creating simple or basic social media buttons, Font Awesome is a great, lightweight option to create them easily without having to use images. Keep reading to check out how it’s done.<\/p>\n

Get Font Awesome Library<\/h3>\n

You can download<\/a>\u00a0the Font Awesome library and place it onto your server to link to, but if you want an even more lightweight option, you can simply link to their library in the <head> section of your HTML files or at the top of your StyleSheet using the @import rule. See the code\u00a0you can use to link to the Font Awesome library below:<\/p>\n

<link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/font-awesome\/4.5.0\/css\/font-awesome.min.css\"><\/pre>\n

The HTML<\/h3>\n

For this example, let’s create icons for Twitter, Facebook, and Instagram. To see a list of ALL the Font Awesome icons and their accompanying code, head over\u00a0to this page<\/a>. Here’s the HTML you’ll need to get started:<\/p>\n

<i class=\"fa fa-facebook\" aria-hidden=\"true\"><\/i>\r\n<i class=\"fa fa-twitter\" aria-hidden=\"true\"><\/i>\r\n<i class=\"fa fa-instagram\" aria-hidden=\"true\"><\/i><\/pre>\n

The results of the HTML above should look something like this:<\/p>\n

\"Screen<\/p>\n

The CSS<\/h3>\n

To really make these icons unique we need to add some styling. Let’s turn them into rounded icons, and let’s add some colors to reflect the brands of each social media network. Take a look at the CSS below to see how it’s done.<\/p>\n

 i.fa.fa-facebook, i.fa.fa-twitter, i.fa.fa-instagram{\r\n border-radius: 100%;\r\n font-size: 28px;\r\n height: 38px;\r\n line-height: 40px;\r\n margin: 5px;\r\n text-align: center;\r\n width: 38px;\r\n }\r\n i.fa.fa-facebook{\r\n border: 1px solid #3B5998;\r\n color: #3B5998;\r\n }\r\n i.fa.fa-twitter{\r\n border: 1px solid #00aced;\r\n color: #00aced;\r\n }\r\n i.fa.fa-instagram{\r\n border: 1px solid #833ab4;\r\n color: #833ab4;\r\n }<\/pre>\n

After applying the CSS above, your social media icons should look similar to this:<\/p>\n

\"Screen<\/p>\n

Styled beautifully and reflecting the brand identity of each platform!<\/p>\n

Extras: Hover Effects<\/h3>\n

Now that you’ve got your icons styled, adding hover, active, visited, etc effects using pseudo-selectors is really easy. A cool hover effect to add is to change the opacity of the icons when they’re hovered over. To do that, you just need to add the following CSS:<\/p>\n

i.fa.fa-facebook:hover, i.fa.fa-twitter:hover, i.fa.fa-instagram:hover{\r\n opacity: .6;\r\n}<\/pre>\n

Compare the icons in the image below with the one above, and you’ll see that the opacity of the Instagram icon is less opaque than the others or than the one in the image above — that’s because it has the hover effect applied to it.<\/p>\n

\"Screen<\/p>\n","protected":false},"excerpt":{"rendered":"

Font Awesome is a really useful tool that provides developers with free access to hundreds of different icons and symbols to use in the projects in place of images and pngs. The great thing about using Font Awesome icons is that because they’re technically characters instead of images, the colors and sizes of the characters … Continue reading “Using Font Awesome to Create Social Icons”<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":2573,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/2568"}],"collection":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/comments?post=2568"}],"version-history":[{"count":2,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/2568\/revisions"}],"predecessor-version":[{"id":2575,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/2568\/revisions\/2575"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/media\/2573"}],"wp:attachment":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/media?parent=2568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/categories?post=2568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/tags?post=2568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}