All I want to do is replace a background image in CSS with an icon font, not icon image. I can't get it done. This is the CSS property:
.social-networks .twitter{background:url(../images/social/twitter.png);}
This is the code in PHP:
<ul class="social-networks"> <?php if (my_option('twitter_link')): ?> <li> <a href="<?php echo my_option('twitter_link'); ?>" class="twitter">twitter</a> </li> <?php endif; ?>
The way I insert an incon font is <span class="icon">A</span>
To use font awesome icons as CSS content code follow the below steps. Add a unique CSS class name to the icon element you want to use. Set the font-weight css property as 900 (For Solid), 400 (Regular or Brands), 300 (Light for pro icons). Set the content css property to the unicode value font awesome icon.
In order to include Font Awesome , you need to include <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.1/css/all.css" integrity="sha384-O8whS3fhG2OnA5Kas0Y9l3cfpmYjapjI0E4theH4iuMD+pLhbf6JI0jIMfYcK3yZ" crossorigin="anonymous"> on your html file then use it to css .
Icon fonts are just fonts. However, instead of containing letters or numbers, they contain symbols and glyphs. You can style them with CSS in the same way you style regular text which has made them a popular choice on the web.
You could try something like this: FIDDLE
Let's say you have your DIV:
<div class="test"></div>
you create your css style like this:
.test { width: 100px; height: 100px; border: 2px solid lightblue; } .test:before { content: "H"; width: 100%; height: 100%; font-size: 5.0em; text-align: center; display: block; line-height: 100px; }
in the property content
you choose your "letter" and then you can change the font-size
, font-weight
, color
, etc...
There is a content property in css:
.icon-rocket:after { content: "{Symbol for rocket}"; }
http://www.w3schools.com/cssref/pr_gen_content.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With