TTF Font not being displayed when using @Font-Family

六眼飞鱼酱① 提交于 2020-01-25 21:11:29

问题


I am trying to add a Font to a website im making using @Font-Face but its not working. I did it exactly like in the link above, but its not working.

My Code:

@font-face {
    font-family: 04B;
    src: url("04b.ttf") format('truetype');
    
}

table {
    margin:auto;
    text-align:center;
	font-size:40px;
    font-family: 04B;
    table-layout: fixed;
    width: 100%;
}

h1 {
	text-align:center;
	font-size:50px;
    font-family: 04B;
}
<h1>Problem is that the font displays exactly like it does in this demo window but shouldnt since I added a font</h1>

Also the font im trying to use is a TTF font which I got from here. The font is also located in the same directory as the CSS file so I think that should be totally fine

I tried testing it in Edge, IE and Chrome and its always the same...

Am I just being really stupid and missing something?


回答1:


Making a kit like Pangloss suggested in the comments seems to have fixed it. Im still not sure what I did wrong, but following the exact instructions of the Kit worked perfectly :D



来源:https://stackoverflow.com/questions/33188906/ttf-font-not-being-displayed-when-using-font-family

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!