css - Poppins @import 无法正常工作的外部样式问题
问题描述
我正在制作一个非常简单的索引页面,并试图合并一些特定的字体。我的目标是@import
从 Google API URL Poppins,然后使用*
选择器将其添加到每个元素。我的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 而不是 sans-serif。我知道这可能有点迂腐,但我不想要内部造型。为什么我的@import
标签不起作用?感谢您的回答!
解决方案
用正文替换 *
body {
font-family: 'Poppins';
}
推荐阅读
- javascript - window.parent.postMessage 不适用于 iframe 中的 scr="'data:text/html;charset=utf-8"
- angular - 如何在 Ionic Ecommerce App 中应用产品搜索
- dns - 如何强制用户从特定的办公地点到特定的 ADFS 服务器
- delphi - AdvBadgeGlowButton1 标题上的 delphi 用例
- c++ - 如何在 RPi3 上的交叉编译应用程序的 MainWindow 上显示边框和标题栏?
- php - 如何在站点子文件夹中配置 php symfony4 应用程序(路由问题)
- listview - 显示弹出菜单后 ListView HitTest 返回错误值
- mongodb - 无法在 mongodb 中搜索“一次”
- firebase - 带有firebase数据库的简单js todo应用程序
- javascript - nodejs异步/承诺地狱