Poppins@import无法处理外部样式问题



我正在制作一个非常简单的索引页面,并尝试合并一些特定的字体。我的目标是从Google API URL中@importPoppins,然后使用*选择器将其添加到每个元素中。我的CSS如下:

@import url('https://fonts.googleapis.com/css?family=Poppins');

* {
margin: 0;
padding: 0;
font-family: 'Poppins';
}

然而,当我这样做时,字体在默认的无衬线框中保持完全相同。在其他一些帖子之后,(字体家族"Poppins"在我的网站上加载时无法正常工作(我在我的html:中这样做了

<!DOCTYPE html>
<html>
<head>
<title>Wavy Section SVG</title>
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
<style type="text/css">
* {
margin: 0;
padding: 0;
font-family: 'Poppins';transition: 
}
</style>
</head>
<body>
<h2>Text</h2>
</body>
</html>

然后它完美地工作了,允许文本是Poppins而不是无衬线。我知道这可能有点迂腐,但我不想要内部造型。为什么我的@import标签不起作用?谢谢你的回答!

用主体替换*

body {
font-family: 'Poppins';
}

只需检查url即可。

示例:

@导入url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@1,100&display=swap'(;

最新更新