Font-Face Not Loaded

@font-face not working

Double period (..) means you go up one folder and then look for the folder behind the slash.
For example:

If your index.html is in the folder html/files and the fonts are in html/fonts, the .. is fine (because you have to go back one folder to go to /fonts). Is your index.html in html and your fonts in html/fonts, then you should use only one period.

Another problem could be that your browser might not support .eot font-files.

Without seeing more of your code (and maybe a link to a live version of your website), I can't really help you further.

Edit: Forget the .eot part, I missed the .ttf file in your css.

Try the following:

@font-face { 
font-family: Gotham;
src: url(../fonts/gothammedium.eot);
src: url(../fonts/Gotham-Medium.ttf);
}

CSS @font-face not working?

Best practices is to always use a relative paths not absolute ones, to ensure it works for any domain.

From your code, I'm assuming you are having the following structure:

  • Root

    • index.html
    • add_ons

      • style_sheets

        • style.css
      • sources

        • fonts

          • Pier.woff2
          • Pier.woff
          • Pier.ttf

You could simply update your paths in the CSS from:

@font-face {
font-family: 'Pier';
src: url('add_ons/sources/fonts/Pier.woff2') format('woff2');
src: url('add_ons/sources/fonts/Pier.woff') format('woff');
src: url('add_ons/sources/fonts/Pier.ttf') format('truetype');
}

To:

@font-face {
font-family: 'Pier';
src: url('../sources/fonts/Pier.woff2') format('woff2');
src: url('../sources/fonts/Pier.woff') format('woff');
src: url('../sources/fonts/Pier.ttf') format('truetype');
}

@font-face not working, fonts seems not to be loaded

The issue you are having is because you are using ~ to select your home directory.

Try to upload the fonts somewhere else and reference to the files either with absolute URL path:

url ('http://www.anywebsite.com/Content/fonts/BYekan.eot');

or with relative path for example:

url ('Content/fonts/BYekan.eot');

In your case the issue it's because you cannot reach the directory containing the font files because CSS does not understand the symbol ~ for referencing your home directory.

@font-face not working in CSS

Try to include all the glyphs from here. Including only ttf doesn't work in all browsers. Change your stylesheet to reflect something like this, which is the standard way:

@font-face {
font-family: 'myFont';
src: url('tiza-webfont.eot');
src: url('tiza-webfont.eot?#iefix') format('embedded-opentype'),
url('tiza-webfont.woff') format('woff'),
url('tiza-webfont.ttf') format('truetype'),
url('tiza-webfont.svg#TizaRegular') format('svg');
font-weight: normal;
font-style: normal;
}

And make sure you are adding this CSS file on the same directory as all your font files exist. And use the CSS to link here.

So if you have the font files (ttf, svg, woff, etc.) in the directory: myserver/Fonts/, then you need to add the CSS file like tiza.css in myserver/Fonts/tiza.css.

Make sure the above CSS is accessible publicly by a web browser through HTTP like:

http://mydomain/myserver/Fonts/tiza.css

And include it in your HTML like:

<link rel="stylesheet" href="http://mydomain/myserver/Fonts/tiza.css" />

The main thing is that you must make sure you are clear of any 404 or 4xx errors on your console. Something like this is what that makes it not work:

Sample Image

Font face doesn't load all fonts

How are you calling the font elsewhere in your CSS? Your @font-face rules look correct. The browser will only download the font files it needs after parsing the CSS. If you were to use the following style rules, all the font weights would be downloaded:

h1 {
font-family: 'Atlas Grotesk';
font-weight: bold;
}

p {
font-family: 'Atlas Grotesk';
font-weight: normal;
}

.heading {
font-family: 'Atlas Grotesk';
font-weight: 100;
}

It sounds like you might have set a global font weight, such as 100, that is preventing the other font weights from being set. Additional context might be helpful in this instance.

@font-face is not working for CSS with correct format, generation, and directory path

I found out what was the issue:

@font-face {
font-family: "Sevastopol_Interface";
src: url("Fonts//Sevastopol-Interface//Sevastopol-Interface.ttf");
}

The issue is that my path was not quite right. Backslashes are indeed correct but I needed two of them instead of one as I am on a windows machine. Not something like linux where you would only need one. Thanks to @Syed Muhammad Moiz and @Kusal Darshana for leading me to that conclusion.

@font-face not loading font

Internet Explorer uses the version .woff of the font, which is not used by you in the code, instead of using the version .eot. I used the @font-face generator tool from fontsquirrel to get all the different font variations

The output should look something like this:

@font-face{
font-family: 'test';
src: url('../fonts/FontName.eot'),
url('../fonts/FontName.eot?#iefix') format('embedded-opentype'),
url('../fonts/FontName.woff') format('woff'),
url('../fonts/FontName.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}


Related Topics



Leave a reply



Submit