Custom Bootstrap Glyphicon: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
| Line 13: | Line 13: | ||
## Click on a glyph from one of their free fonts. A modal dialog should open with the glyph details displayed. | ## Click on a glyph from one of their free fonts. A modal dialog should open with the glyph details displayed. | ||
## Click download. | ## Click download. | ||
## I think as long as the artboard is square in Illustrator and the icon fills the artboard, it should be good. | ## I think as long as the artboard is square in Illustrator and the icon fills the artboard, it should be good.<br />Make sure to check the "Use Artboards" option when saving as .svg from Illustrator. | ||
# [https://icomoon.io/app/#/projects Create a new project] at IcoMoon. | # [https://icomoon.io/app/#/projects Create a new project] at IcoMoon. | ||
# '''Load''' | # '''Load''' | ||
Revision as of 20:25, 19 February 2015
Objective
Create a custom "glyphicon" to be used with Twitter Bootstrap-based stylesheets.
Creating the icons & fonts
IcoMoon hosts a library of glyphicons as well as a mechanism to upload custom SVG to create new glyphicons.[1]
- Download glyph to use as a starter template (optional)
- Go to IcoMoon
- Click on a glyph from one of their free fonts. A modal dialog should open with the glyph details displayed.
- Click download.
- I think as long as the artboard is square in Illustrator and the icon fills the artboard, it should be good.
Make sure to check the "Use Artboards" option when saving as .svg from Illustrator.
- Create a new project at IcoMoon.
- Load
- Import Icons button
- Select the .svg file(s) and upload.
- Select the icons to include in the font.
- Generate Font in the lower right.
- Font > Download in the lower right.
- This generates a zip file named
icomoon.zip. - The zip file contains
.woff,.ttf,.eot, and.svgversions of the font, all located infontsfolder in the zip folder. - The font files are all named
icomoon.*. (Optionally) rename them to whatever is desired. - Move the font files to the web site, e.g. in a
/fonts/folder.
- This generates a zip file named
CSS
Assuming that the site uses Twitter Bootstrap's stylesheet:
// custom glyphicon font files //
@include font-face("Glyphicons Littledamien", font-files("../fonts/glyphicons-littledamien.woff", "../fonts/glyphicons-littledamien.ttf", "../fonts/glyphicons-littledamien.eot", "../fonts/glyphicons-littledamien.svg"));
Defining the individual glyphicons:
.glyphicon-custom {
font-family: "Glyphicons Littledamien";
}
.glyphicon-paid {
&:before {
content: '\e600';
}
}
Usage
.glyphiconis Bootstrap's base class..glyphicon-customoverrides Bootstrap's glyphicon font with the custom font..glyphicon-paidis the specific glyphicon to display.
<span class="glyphicon glyphicon-custom glyphicon-paid"></span>
Notes
- ↑ Create a Custom Glyphicon (Stackoverflow)