有人可以告诉我在css文件中放置什么以安装名为“ Burbank.otf”的字体,以及在html中放置什么以使该字体成为文本吗?
我在HTML中有这个
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<body>
<h1>Hey, June</h1>
</body>
</head>
</html>
<html>
<head>
<title>Test</title>
</head>
这在CSS中:
@font-face { font-family: Junebug; src: url('Burbank.otf'); }
.junebug { font-family: Junebug; font-size: 4.2em; }
答案 0 :(得分:0)
您正在css文件中选择类.junebug,但是没有带有此类的html标记。
您的CSS:
@font-face { font-family: Junebug; src: url('Burbank.otf'); }
.junebug { font-family: Junebug; font-size: 4.2em; }
给类junebug一个html标签,例如:
<h1 class="junebug">Hey, June</h1>
答案 1 :(得分:0)
您可以像这样简单地使用它:
@font-face {
font-family: Burbank.otf ;
src: "url from the font"
}
your cla{
font-family: Burbank.otf;
}
我希望这会有所帮助。
答案 2 :(得分:0)
如果您的字体位于HTML的同一文件夹中,则可以使用以下CSS:
@font-face {
font-family:'Burbank';
src: url('Burbank.otf') format('opentype');
font-style: normal;
font-weight: normal;
}
.junebug { font-family: Burbank; font-size: 4.2em; }
要使其正常工作,您需要使用与字体文件名称相同的字体系列名称。