CSS@font-face:如何正确使用它?
我下载了一种新字体并存储在CSS@font-face:如何正确使用它?,css,fonts,Css,Fonts,我下载了一种新字体并存储在${RootFolder}/font 在styles.css文件中,我写道: @font-face { font-family: roboto; url('../fonts/Roboto-Italic.ttf'); } h1 { font-family: roboto; } <h1> hello </h1> 我用html写了: @font-face { font-family: roboto; url(
${RootFolder}/font
在styles.css文件中,我写道:
@font-face {
font-family: roboto;
url('../fonts/Roboto-Italic.ttf');
}
h1 {
font-family: roboto;
}
<h1> hello </h1>
我用html写了:
@font-face {
font-family: roboto;
url('../fonts/Roboto-Italic.ttf');
}
h1 {
font-family: roboto;
}
<h1> hello </h1>
你好
但我仍然看不到字体已经改变
你知道我做错了什么吗 在字体中添加src:url('../fonts/Roboto Italic.ttf');而不是url('../fonts/Roboto Italic.ttf')
在字体中添加src:url('../fonts/Roboto Italic.ttf');而不是url('../fonts/Roboto Italic.ttf') 使用谷歌字体
只需将其导入css。将@font-face替换为:
@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,700');
并使用类似字体系列:roboto代码>使用谷歌字体
只需将其导入css。将@font-face替换为:
@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,700');
并使用类似字体系列:roboto代码>试着像这样使用它:
@font-face {
font-family: "roboto";
src: url('fonts/Roboto-Italic.ttf');
}
h1 {
font-family: roboto;
}
试着像这样使用它:
@font-face {
font-family: "roboto";
src: url('fonts/Roboto-Italic.ttf');
}
h1 {
font-family: roboto;
}