+ 1
CSS - Access to font
Hello, I want to add a font to my code, but I cannot do it with this: @font-face { font-family: 'PixelFont_CMD'; src: url('http://panda.xf.cz/CSS/PixelFont_CMD.ttf') format('truetype'); font-weight: normal; font-style: normal; } When I run code with this code, console says, that I cannot access font. Can somebody help me or give me other way to add font to code? https://code.sololearn.com/WRp7lqD7cbwZ/?ref=app
4 Respuestas
+ 1
I see.
The host of the ttf file won't let you use the font directly. It could be intentional or just a default setting that wasn't changed.
Here's the longer explanation:
https://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work
But, since the file is downloadable, you can host it yourself. I tested it on my local machine and it works fine. If you want to use it in the Code Playground, you will want to put the ttf file in Dropbox or some other file repo.
I hope this helps!
0
In the third line, is there a missing semicolon?
I tried the font on my page, dosnt work for me too.
0
It seems fine. Do you have the full code?
0
Updated - Posted code