【发布时间】:2021-09-13 04:18:51
【问题描述】:
我在我的网站中使用带有 bootstrap-4 机器人字体的机器人字体系列不起作用。它在这种情况下有效:我是这样写的"font-family:"roboto-bold"; 当我用"sans-serif" 字体"font-family: 'roboto-bold',sans-serif;" 写作时,这种情况就不行了
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap');
@font-face {
font-family: 'roboto-bold',sans-serif;
src: url('./fonts/roboto/Roboto-Bold.woff') format('woff2'),
url('./fonts/roboto/Roboto-Bold.woff') format('woff');
font-weight: bold;
font-display: swap;
unicode-range: U+000-5FF;
}
body {
font-family: 'roboto-bold',sans-serif;
}
h2 {
/* font-family: 'Roboto'; */
font-family: 'roboto-bold',sans-serif;
font-size: 47;
color: red;
}
.tab-title{
font-size: 30px;
text-align: center;
font-family: 'roboto-bold',sans-serif ;
color: aqua;
}
<!doctype html>
<html lang="en">
<head>
<title>Doora Invoice</title>
<meta charset="UTF-8">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="demostyle.css">
</head>
<body>
<main>
<h2>hello</h2>
<h3 class="tab-title"> overview</h3>
<p>Hello</p>
</main>
</body>
</html>
【问题讨论】:
-
这可能是您的
unicode-range定义的问题吗?我用谷歌搜索了5ff,我的第一个结果是,这不是有效的 unicode 字符:fileformat.info/info/unicode/char/5FF/index.htm 你可以尝试不定义unicode-range吗? -
是的,我尝试不使用“unicode-range”,但结果仍然相同
标签: html css font-face font-family