import Gotham book font with css

Asked

Viewed 803 times

1

I’m trying to import the Gotham-book font, it’s in the fonts/GOTHAM-BOOK.ttf folder, but although I try to import it doesn’t change anything. How can I do this?

.table td{
    border: 0px !important;
    margin: 0px;
    padding: 0px;
    src: url('fonts/GOTHAM-BOOK.ttf');
    font: 'Gotham Book', Gotham-Book, sans-serif;
    font-size: 10pt;
}

1 answer

4


You are trying to import the font the wrong way, first you have to define a font-face in your style sheet, and then use it:

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

Then just use it like any other source:

.table td {
    font-family: "FontName", sans-serif;
}

And on that website you can download the Gotham Book for web with css style ready to use.

* Note that "Fontname" is just an example name and you should replace them with your Webfont files.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.