SASS files that makes it super duper easy to add fonts based icons in SASS - No reason to remember the key anymore
You can download this project in either zip or tar formats.
yadi yadi follow me on twitter ... twitterThe concept is pretty straight forward: The iconify-[fontname].scss file contains a bunch of classes thats each are a single icon from the font set.
To include a icon to a class use a @extend icon-[name of icon]; to the class in the sass file
Now theres no reason to remember that its the "N" key thats deifne the heart icon :)
Take the iconify-[fontname].scss and drop it into you /sass/ folder
include it as you would with all other .scss files
Add @include "iconify-[fontname].scss" to you sass file
use the @extend .icon-[iconname] to easy add the icon.
Place it with [class]:before or [class]:after simpel n easy.
@import "iconify-websymbols.scss"; //import the iconset iconify-[fontfacename].scss
h1:before {
@extend .icon-cloud; //add the .icon-cloud{} to h1
font-size:1em;
margin:-1em 1em 0em 0em;
color:rgba(255,255,255,.9);
text-shadow: 0px 0px 5px lightblue;
}
h2:after {
@extend .icon-heart; //add this definition to the .icon-heart{} will be added after the h2
font-size:1.6em;
color:pink;
}
iconify-websymbols.scss
// Define the font
// WebSymbolsRegular http://www.justbenicestudio.com/studio/websymbols/
@font-face {
font-family: 'WebSymbolsRegular';
src: url('../fonts/websymbols/websymbols-regular-webfont.eot');
src: url('../fonts/websymbols/websymbols-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/websymbols/websymbols-regular-webfont.woff') format('woff'),
url('../fonts/websymbols/websymbols-regular-webfont.ttf') format('truetype'),
url('../fonts/websymbols/websymbols-regular-webfont.svg#WebSymbolsRegular') format('svg');
font-weight: normal;
font-style: normal;
}
//sets up the base icon
.icon {
font-family: WebSymbolsRegular;
font-size: 16px;
margin-right: 10px;
vertical-align: middle;
}
//define all the icons & extends the .icon class to safe us some kb.
.icon-view-portrait { content: "a"; @extend .icon;}
.icon-view-album { content: "a"; @extend .icon;}
//lets get the font icon type
@font-face {
font-family: 'WebSymbolsRegular';
src: url("../fonts/websymbols/websymbols-regular-webfont.eot");
src: url("../fonts/websymbols/websymbols-regular-webfont.eot?#iefix")
format("embedded-opentype"), url("../fonts/websymbols/websymbols-regular-webfont.woff") format("woff"),
url("../fonts/websymbols/websymbols-regular-webfont.ttf") format("truetype"),
url("../fonts/websymbols/websymbols-regular-webfont.svg#WebSymbolsRegular") format("svg");
font-weight: normal; font-style: normal;
}
//a ton of classes generated
.icon, .icon-heart ..... .icon, .icon-view-portrait, .icon-view-album .....{
font-family: WebSymbolsRegular;
font-size: 16px; margin-right: 10px;
vertical-align: middle;
}
//naming the icons to something we can actually remember & use
.icon-star { content: "R"; }
.icon-heart { content: "N"; }
.icon-heart-alt { content: "O"; }
If you wanna use another icon library then you just @import another iconify-[typename].scss file
Every icon is defined with .icon-[name]
.icon-cloud {
content: "C"; //the icon
@extend .icon; //use the basic icon style
}
| Icon name | Last Name | Language |
|---|---|---|
| 1 | 2 | 3 |
You do know that time when Daddy got fontfaced and met mother icon at the bar? ...
use @fontface for getting the icons - its just a font like good old dingbats.
You can also clone the project with Git by running:
$ git clone git://github.com/mortendk/icon-font-css
get the source code on GitHub : mortendk/icon-font-css