CSS @font-face Not Working in Firefox: Resolving Cross-Domain and Local Hosting Issues
Firefox exhibits peculiarities in rendering custom fonts defined using the @font-face rule, particularly when the HTML and CSS files reside locally or on different domains.
Local Hosting (file:///)
Firefox enforces a strict origin policy for local file access (file:///). To resolve this:
This allows Firefox to access local font resources regardless of document path levels.
Published Site
If the problem persists on a published website, it's worth considering:
<FilesMatch "\.(ttf|otf|eot)$"> <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" </IfModule> </FilesMatch>
Additional Information
For a comprehensive overview of this issue, refer to the following links:
The above is the detailed content of Why Isn't My @font-face Working in Firefox?. For more information, please follow other related articles on the PHP Chinese website!