Skip to content

Instantly share code, notes, and snippets.

@gearmobile
Created June 24, 2015 06:39
Show Gist options
  • Save gearmobile/2b9425cf0a7c5bd1809c to your computer and use it in GitHub Desktop.
Save gearmobile/2b9425cf0a7c5bd1809c to your computer and use it in GitHub Desktop.
FontAwesome CSS content value
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