Created
June 24, 2015 06:39
-
-
Save gearmobile/2b9425cf0a7c5bd1809c to your computer and use it in GitHub Desktop.
FontAwesome CSS content value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Font Awesome - is a web font containing all the icons from the Twitter Bootstrap framework, and now many more. Whilst the implementation in Bootstrap is designed to be used with the <i> element (Bootstrap v2), you may find yourself wanting to use these icons on other elements. | |
To do so, you'll need to use the following CSS on the desired element, and then substitute in the content value for the relevant icon. | |
******************************************** | |
.element { | |
position: relative; | |
} | |
/*replace the content value with the | |
corresponding value from the list below*/ | |
http://astronautweb.co/snippet/font-awesome | |
.element:before { | |
content: "\f000"; | |
font-family: FontAwesome; | |
font-style: normal; | |
font-weight: normal; | |
text-decoration: inherit; | |
/*--adjust as necessary--*/ | |
color: #000; | |
font-size: 18px; | |
padding-right: 0.5em; | |
position: absolute; | |
top: 10px; | |
left: 0; | |
} | |
*********************************************** | |
Note: it is not possible to use ':before' or ':after' pseudo content on <input> elements, however if you instead use <button> it will work as desired. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment