Home > Article > Web Front-end > Why Does My @font-face Work in All Browsers Except for IE9?
@font-face Conundrum: Display Issues in IE9 While Functioning in Other Browsers
In a curious case of web typography glitches, a user has encountered an anomaly with @font-face. The font in question renders perfectly in every browser except IE9, leaving the user puzzled. Moreover, the font inexplicably manifests on the local version of the website but vanishes when deployed live.
The website in question, bigwavedesign.co.uk/gcc/gcc/, utilizes the following @font-face declaration:
@font-face { font-family: 'LeagueGothicRegular'; src: url('league_gothic_0-webfont.eot'); src: local('League Gothic Regular'), url('league_gothic_0-webfont.woff') format('woff'), url('league_gothic_0-webfont.ttf') format('truetype'), url('league_gothic_0-webfont.svg#webfonta36nFpyE') format('svg');font-weight: normal;font-style: normal; }
This anomaly has perplexed the user, prompting them to investigate potential causes. In a surprising discovery, they noticed that a different website, iamthomasbishop.com, managed to render the same font successfully in IE9. Determining how this site achieved this feat remains a puzzle.
Ultimately, the issue was suspected to stem from IE9's preference for the .woff font version over the .eot version. Incorporating the full range of font variations into the project using the smileyface-local subroutine resolved the issue. The updated code now works seamlessly in all IE versions:
@font-face { font-family: "LucidaFax-bold"; src: url("_font/LucidaFax-bold.eot"); src: local("☺"), url("_font/LucidaFax-bold.woff") format("woff"), url("_font/LucidaFax-bold.ttf") format("truetype"), url("_font/LucidaFax-bold.svg#LucidaFax-bold") format("svg"); }
Thus, the mystery of the missing font in IE9 has been unraveled, demonstrating the importance of considering browser-specific quirks in web design and the power of collaborative problem-solving in overcoming technical challenges.
The above is the detailed content of Why Does My @font-face Work in All Browsers Except for IE9?. For more information, please follow other related articles on the PHP Chinese website!