【发布时间】:2020-06-21 10:25:38
【问题描述】:
当我将语言更改为 sr-RS 时,字体样式会发生变化。
这是一个例子en-US:
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,700&display=swap&subset=cyrillic" rel="stylesheet">
</head>
<style>
body {
font-family: 'Montserrat', sans-serif;
}
</style>
<body>
<a>Тест фонта</a>
</body>
<html>
<html lang="sr-RS">
<head>
<meta charset="UTF-8" />
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,700&display=swap&subset=cyrillic" rel="stylesheet">
</head>
<style>
body {
font-family: 'Montserrat', sans-serif;
}
</style>
<body>
<a>Тест фонта</a>
</body>
<html>
如何将语言更改为 sr-RS,但字体样式仍为 en-US?
【问题讨论】:
-
尝试从 src 中删除西里尔字母子集:
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,700&display=swap" rel="stylesheet"> -
@AmitRahav 字体有西里尔字母。唯一的问题是在 lang:'sr-RS' 上显示不同的字体。这就是字体的外观,因为它在 lang:'en-US' fonts.google.com/specimen/Montserrat
-
您是否尝试在 css 值的末尾添加
!important?有时浏览器的默认设置会覆盖服装 css。