My website has font that is not supported/recogniz

2019-08-22 22:34发布

问题:

My website is not showing the appropriate font, PT Sans.ttc. I checked on other browsers and it works fine.

www.farmap-ux.com. Below is CSS code.

@font-face
{
font-family: PT Sans;
font-family: font-family: 'PT Sans', sans-serif;
src: url("http://fonts.googleapis.com/css?family=PT+Sans")
}

So it works on everything like I said (Chrome, Safari, even Opera!) Any ideas? I've tried to find .woff files for the font but I don't think it's in my Font Book.

回答1:

Maybe it's because your @font-face declaration isn't valid at all. It should be something like:

@font-face
{
    font-family: 'PT Sans';
    font-style: normal;
    font-weight: 400;
    src: local('PT Sans'), local('PTSans-Regular'), url(http://themes.googleusercontent.com/static/fonts/ptsans/v4/LKf8nhXsWg5ybwEGXk8UBQ.woff) format('woff');
}

However, it's even better to use the CSS file provided by google:

<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans">

If you want to stick to a CSS import use

@import url(http://fonts.googleapis.com/css?family=PT+Sans);


回答2:

You should really check your css! The syntaxe is miles away from correct.

Also, http://fonts.googleapis.com/css?family=PT+Sans is already a css file! what you should do is import is put it directly into the <head> your html using the link tag.

Have a look at this example: http://www.w3schools.com/tags/tag_link.asp, or just add the following to your html file as said before.

<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=PT+Sans">


回答3:

Following the directions at Google Webfonts should fix your problem.

First, make sure you're including the Google CSS necessary to reference the font files. You have the option to include a LINK tag in your HTML, a @import directive in your CSS, or some Javascript. I recommend the LINK tag for maximum browser compatibility:

<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>

When adding this CSS to your site, Google will automatically determine the correct font type to use for your browser. Not all browsers use WOFF files. Older versions of IE use EOT files, some browsers prefer SVG or TTF. Google is able to sniff for the browser type and modify the included CSS as necessary.

After Google's CSS is included, you only have to reference the font family in your CSS where you want the font to appear.

font-family: 'PT Sans', sans-serif;

That's the only CSS necessary. Remove all the other CSS you linked… as mentioned in the other answers your CSS has some errors.



回答4:

Try:

@font-face {
  font-family: 'PT Sans';
  font-weight: normal;
  src: url("http://fonts.googleapis.com/css?family=PT+Sans");
}