With the use of simple CSS, you can easily use your custom font on your website. But many people find problem getting it work on Internet Explorer. Here is the trick that works across all the browsers. I hope this solution will help many people who are stuck with this problem. I will explain it with a simple example:
src: url(‘fonts/Ayuma2yk.eot?’), /* IE */
‘MyCustomFont’ is the name you want to give to the font family. It is recommended to copy fonts to a separate folder. Ayuma2yk.ttf is a random test font I have used for example.
For Internet Explorer, please note the important tricks here:
1) Instead of common ttf (True Type) font, Internet Explorer requires .eot (Embedded Open Type) font. If you do not have eot, there are so many tools available online, using which you can easily convert your .ttf file to .eot.
2) Use .eot line first. Yes, write the .eot property before .ttf to make it work in IE.
3) Use a question mark after eot font name! Now this is weird, isn’t it?
That’s all. The custom font family is ready to be used now. You can use it normally like you use other fonts.
span style=”font-family:MyCustomFont;”>Hello World!</span>
Please Download an example created with HTML/CSS using the link below.