@font-face and fonts from CDN?

How can i load fonts from a cdn with font-face?

My code:

@font-face {
  font-family: 'fontname';
  src: url('https://addrestothefonts.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

This is not working. Tried creating a .htaccess file and adding:

# Apache config
<FilesMatch ".(eot|ttf|otf|woff)">
	Header set Access-Control-Allow-Origin "*"
</FilesMatch>

# nginx config
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
	add_header Access-Control-Allow-Origin *;
}

But no luck there only gave me “Internal Server Error”.

I think this is more a server question. If you are linking to the font properly and the server just isn’t set up to allow it, then that’s nothing HTML or CSS can fix.

I’ve moved this to the server forum so they can help you more. Doesn’t sound like anything we can fix with HTML/CSS alone.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.