{"id":1962,"date":"2016-06-28T13:48:38","date_gmt":"2016-06-28T13:48:38","guid":{"rendered":"http:\/\/cssreset.com\/?p=1962"},"modified":"2016-06-28T13:49:15","modified_gmt":"2016-06-28T13:49:15","slug":"create-social-media-icons-using-font-awesome-and-css","status":"publish","type":"post","link":"https:\/\/cssdeck.com\/blog\/create-social-media-icons-using-font-awesome-and-css\/","title":{"rendered":"Create Social Media Icons Using Font-Awesome and CSS"},"content":{"rendered":"<p><a href=\"http:\/\/fontawesome.io\/\" target=\"_blank\">Font Awesome<\/a> 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&#8217;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&#8217;re much more dynamic than .jpegs and .pngs.<\/p>\n<p>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 &#8212; no photoshop required.<\/p>\n<p>To start using Font Awesome, make sure you&#8217;ve got their library loaded either on your server or by lining to the <a href=\"http:\/\/fontawesome.io\/get-started\/\" target=\"_blank\">Font Awesome CDN<\/a>\u00a0either in the head of your HTML or at the top of your stylesheets using @import, like this:<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\r\n\r\n\t\t<div class=\"toolbar\">\r\n\r\n\t\t<div class=\"view-different-container\">\r\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\r\n\t\t\t\t\t<\/div>\r\n\r\n\t\t<div class=\"language-name\">HTML<\/div>\r\n\r\n\t\t\r\n\t\t<br clear=\"both\">\r\n\r\n\t<\/div>\r\n\t\r\n\t<div class=\"code\">\r\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">link<\/span> <span style=\"color: #000066\">rel<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;stylesheet&quot;<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;https:\/\/maxcdn.bootstrapcdn.com\/font-awesome\/4.5.0\/css\/font-awesome.min.css&quot;<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\r\n\r\n<\/div>\r\n\n<p>For the purposes of this tutorial, let&#8217;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 <a href=\"http:\/\/fontawesome.io\/icons\/\" target=\"_blank\">here<\/a>).<\/p>\n<p>To add the <a href=\"http:\/\/fontawesome.io\/icon\/facebook\/\" target=\"_blank\">icon<\/a>\u00a0to your site, you&#8217;ll need to place the following HTML code wherever you&#8217;d like the Facebook icon to show up on your page(s).<\/p>\n<pre style=\"box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; padding: 8px 15px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; color: #333333; border: 1px solid #eeeeee; border-radius: 4px; background-color: #fafafa;\"><code class=\"html\" style=\"box-sizing: border-box; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: inherit; padding: 0px; border-radius: 0px; white-space: pre-wrap; background-color: transparent;\"><span class=\"nt\" style=\"box-sizing: border-box; color: #2f6f9f;\">&lt;i<\/span> <span class=\"na\" style=\"box-sizing: border-box; color: #4f9fcf;\">class=<\/span><span class=\"s\" style=\"box-sizing: border-box; color: #d44950;\">\"fa fa-facebook\"<\/span> <span class=\"na\" style=\"box-sizing: border-box; color: #4f9fcf;\">aria-hidden=<\/span><span class=\"s\" style=\"box-sizing: border-box; color: #d44950;\">\"true\"<\/span><span class=\"nt\" style=\"box-sizing: border-box; color: #2f6f9f;\">&gt;&lt;\/i&gt;<\/span><\/code><\/pre>\n<p>Each Font Awesome Icon has its own corresponding class, which you can look up on its individual page on Font Awesome&#8217;s site. Here&#8217;s what the Facebook icon looks like before we apply any styling to it:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1963 aligncenter\" alt=\"Screen Shot 2016-06-28 at 9.32.20 AM\" src=\"https:\/\/cssdeck.com\/blog\/\/wp-content\/uploads\/2016\/06\/Screen-Shot-2016-06-28-at-9.32.20-AM.png\" width=\"38\" height=\"46\" \/><\/p>\n<p>Let&#8217;s add some CSS:<\/p>\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\r\n\r\n\t\t<div class=\"toolbar\">\r\n\r\n\t\t<div class=\"view-different-container\">\r\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\r\n\t\t\t\t\t<\/div>\r\n\r\n\t\t<div class=\"language-name\">css<\/div>\r\n\r\n\t\t\r\n\t\t<br clear=\"both\">\r\n\r\n\t<\/div>\r\n\t\r\n\t<div class=\"code\">\r\n\t\t<ol class=\"css\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">i<span style=\"color: #6666ff\">.fa<\/span>.fa-facebook<span style=\"color: #00AA00\">&#123;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">border-radius<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #933\">100%<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">font-size<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #933\">28px<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">height<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #933\">38px<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">line-height<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #933\">40px<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">margin<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #933\">5px<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">text-align<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #993333\">center<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">width<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #933\">38px<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">border<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #933\">1px<\/span> <span style=\"color: #993333\">solid<\/span> <span style=\"color: #cc00cc\">#3B5998<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">color<\/span><span style=\"color: #00AA00\">:<\/span> <span style=\"color: #cc00cc\">#3B5998<\/span><span style=\"color: #00AA00\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #00AA00\">&#125;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\r\n\r\n<\/div>\r\n\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-1964 aligncenter\" alt=\"Screen Shot 2016-06-28 at 9.40.37 AM\" src=\"https:\/\/cssdeck.com\/blog\/\/wp-content\/uploads\/2016\/06\/Screen-Shot-2016-06-28-at-9.40.37-AM.png\" width=\"98\" height=\"94\" \/><\/p>\n<p>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.<\/p>\n<div class=\"wp-socializer wpsr-share-icons \" data-lg-action=\"show\" data-sm-action=\"show\" data-sm-width=\"768\" ><h3>Share and Enjoy !<\/h3><div class=\"wpsr-si-inner\"><div class=\"wpsr-counter wpsrc-sz-32px\" style=\"color:#000\"><span class=\"scount\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook,twitter,linkedin,pinterest,print,pdf\">0<\/span><\/span><small class=\"stext\">Shares<\/small><\/div><div class=\"socializer sr-popup sr-32px sr-circle sr-opacity sr-pad sr-count-1 sr-count-1\"><span class=\"sr-facebook\"><a rel=\"nofollow\" href=\"https:\/\/www.facebook.com\/share.php?u=\" target=\"_blank\"  title=\"Share this on Facebook\"  style=\"color: #ffffff\" ><i class=\"fab fa-facebook-f\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-twitter\"><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%20-%20%20\" target=\"_blank\"  title=\"Tweet this !\"  style=\"color: #ffffff\" ><i class=\"fab fa-twitter\"><\/i><\/a><\/span>\n<span class=\"sr-linkedin\"><a rel=\"nofollow\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=\" target=\"_blank\"  title=\"Add this to LinkedIn\"  style=\"color: #ffffff\" ><i class=\"fab fa-linkedin-in\"><\/i><\/a><\/span>\n<span class=\"sr-pinterest\"><a rel=\"nofollow\" href=\"https:\/\/www.pinterest.com\/pin\/create\/button\/?url=&amp;media=&amp;description=\" target=\"_blank\"  title=\"Submit this to Pinterest\"  style=\"color: #ffffff\" data-pin-custom=\"true\"><i class=\"fab fa-pinterest\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"pinterest\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-print\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Print this article \"  style=\"color: #ffffff\" ><i class=\"fa fa-print\"><\/i><\/a><\/span>\n<span class=\"sr-pdf\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Convert to PDF\"  style=\"color: #ffffff\" ><i class=\"fa fa-file-pdf\"><\/i><\/a><\/span><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>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&#8217;s becoming a really nice alternative to downloading PSD icon sets, largely because since [&#8230;]<\/p>\n<p><a class=\"more-link article\" href=\"https:\/\/cssdeck.com\/blog\/create-social-media-icons-using-font-awesome-and-css\/\" title=\"Click to read 'Create Social Media Icons Using Font-Awesome and CSS'\">Read Article<\/a><\/p>\n","protected":false},"author":18,"featured_media":1964,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6,7],"tags":[],"_links":{"self":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/1962"}],"collection":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/comments?post=1962"}],"version-history":[{"count":2,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/1962\/revisions"}],"predecessor-version":[{"id":1966,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/1962\/revisions\/1966"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media\/1964"}],"wp:attachment":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media?parent=1962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/categories?post=1962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/tags?post=1962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}