css - 在 scss 中导入字体变体 - React
问题描述
我是新手,css
所以我有点困惑。这是我在index.scss
文件中所做的
@import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,400i,700,800,800i,900i&display=swap');
body {
font-family: 'Nunito Sans', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
我想做所有的段落Nunito Sans Bold Italic
。我怎么能在特定的文件中做到这一点说components/link.js
解决方案
要使所有使用 Nunito Sans 的段落以粗体和斜体设置样式,您首先需要定位每个p
元素,然后添加您需要的字体系列和字体样式。例如:
p {
font-family: 'Nunito Sans', sans-serif;
font-weight: bold;
font-style: italic;
}
如果您只想在该特定组件中使用此 css,请创建一个单独的 scss 文件并将其仅导入该组件,例如:
@import './link-style.scss';
推荐阅读
- vb.net - 如何获取在 Windows.Forms PictureBox.Image 中查看的图像的原始大小
- r - 过滤具有多个条件的data.frame而不写出它们
- node.js - GCP - 无法在 Cloud Run 中使用 Google Secret Manager (@google-cloud/secret-manager)
- typescript - TypeScript 中的多态性:宽松类型
- c# - 如何在 c# windows 应用程序中获取颜色的颜色名称字符串
- python - 为什么在 PyPy 中安装模块时出现错误
- makefile - Gnu make:来自subst的宏中的目标
- selenium - 获取 org.openqa.selenium.NoSuchElementException:没有这样的元素:无法找到元素:{“method”:“xpath”,“selector”:错误
- r - 我可以使用 for 循环在使用 cvxr 的线性问题中指定约束吗?
- reactjs - 在等待承诺解决时添加一个 Spinner