Font-face not working in IE, otf font
I know this has been asked several times, but I couldn't get it to work after trying them. This is the simple CSS I am using to import a custom font. Also, I am using this with download.
@font-face {
font-family: Montserrat-Black;
src: url(Montserrat-Black.otf);
}
It doesn't work in IE11. Please help me. Thank.
source to share
The Internet Explorer uses the eot (legacy) or woff format. See MSDN
Anyway, I use this code for maximum compatibility:
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
source to share
IE11:
If you get error code CSS3114
in dev tools, you need to change the first bits of the font file. This will allow IE to install the font.
Npm module:
You can use the ttembed-js
npm module , which will make the changes for you.
https://www.npmjs.com/package/ttembed-js
Using: ttembed-js path/to/Montserrat-Black.otf
source to share
If you are having this problem and your application is running on IIS, try adding the correct MIME types to your web.config as SO-user Martin Buber explained in this comment
source to share
Since this question was the first hit in my search, let me suggest the solution I found:
Paul Irish Bulletproof @ font-face Syntax
Or just use the generator at FontSquirrel.com http://www.fontsquirrel.com/fontface/generator. They also provide a "single CSS syntax to control them all" in the set of fonts they create.
source to share