How do I load an external source into a CSS/HTML document?

Asked

Viewed 23,450 times

0

I am trying to import an external source to a file CSS

So that’s my code CSS:

body{
    background-color: white
}

@font-face { 
   font-family: 'devgothic';
   src: url('/fonts/devgothic.eot');
   src: local('devgothic'), local('devgothic'), url('/fonts/devgothic.ttf') format('truetype');
}

.fonte {
    font-family: 'devgothic';
    color: purple;
}

Apparently, the folder structure is correct, but it just doesn’t work.

  • You need to see if the web server is configured to give the right mime-type for these extensions you are using from source. On my Apache servers I had to register almost all of them manually. Test with a source from another domain, to see if it changes behavior.

1 answer

2


The way you are doing it is somewhat wrong. See the example below:

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

.palavra{
   font-family: "Calibri";
}

Browser other questions tagged

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