html - 网站未在本地使用导入的 Google 字体,但在 codepen 中工作
问题描述
我有一个测试站点,我正在制作它不使用导入的字体或备份字体。奇怪的是,虽然它不会在本地更改字体,但将代码放入 codepen 就可以了。
如果您想知道,我的所有文件都在正确的位置(见图)
此外,这是我的源代码的codepen 链接,它也在下面:
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;700&display=swap');
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-family: 'Montserrat', sans-serif;
font-size: 10px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Test Page</title>
<meta name="description" content="Test Page" />
<meta name="author" content="test Page" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="style.css" ref="stylesheet">
</head>
<body>
<section id="hero">
<div class="hero container"></div>
<div>
<h1>Test Header</h1>
<a href="javascript:void(0)" type="button" class="cta">Test Button</a>
</section>
<script src="main.js"></script>
</body>
<html>
解决方案
它rel
不是ref
用于链接样式表
<link href="style.css" rel="stylesheet">
推荐阅读
- jquery - 在jquery中组合多个函数
- python - 通过单击 tkinter python 中的按钮更新标签文本
- python - 如何迭代每个列名并将其附加到python中的表或数据框中
- javascript - 将新对象添加到数组中到nodeJS中的js文件中
- node.js - 应用程序崩溃 - 在 nodejs 中启动之前等待文件更改
- windows - Docker for windows:安装到容器后无法删除目录
- ios - 斯坦福 CS193p - 根据卡数更改字体大小?
- ios - 我如何通过其记录名称查询 CloudKit 以获取特定记录?
- python - 如何解决builtins.pyi 中的问题?
- matlab - matlab的corrcoef函数工作错误