css - 在 sass 中正确记录 h1...h6
问题描述
我目前正在学习 sass,我想将我的 css 重写为 sass 进行学习。我想知道如何在 sass 中保存 h1 ... h6。我做得好吗?
这是 sass 中的正确记录吗?
h1 {
font-family: "Aleo", sans-serif;
font-weight: 700;
margin: 0 0 20px 0;
line-height: 1.5;
color:#000;
}
h2 {
@extend h1;
font-size: 44px;
}
h3 {
@extend h1;
font-size: 22px;
}
h4 {
@extend h1;
font-size: 20px;
color:#9b9578;
font-weight: 400;
text-transform: uppercase;
}
h5 {
@extend h1;
font-size: 16px;
font-weight: 400;
text-transform: uppercase;
}
谢谢大家的建议!
解决方案
您可以使用“mixin”和“include”事件。
<!-- Set your wants -->
@mixin anything{
font-family: "Aleo", sans-serif;
font-weight: 700;
margin: 0 0 20px 0;
line-height: 1.5;
color:#000;
}
<!-- and assign to your tag. -->
h2{
@include anything;
font-size: 44px;
}
我认为这是您寻找的正确方法。
推荐阅读
- c++ - 更改结构数据类型中每个字符的 ASCII 值
- java - 应用程序结构中的异常
- reactjs - 如何使用 react-testing-library 和 framer-motion 测试 mousemove 拖放
- python - 测试 Python 任务或未来是否成功完成的最简洁方法是什么?
- three.js - [已解决]从 Blender 到 THREEJS,使用 GLTF 导出具有 UV 纹理和材质颜色的网格:材质颜色丢失
- java - 加权字符串以到达不同的端点
- postgresql - Azure DB for PostgreSQL 上的 PostgreSQL 作业计划程序
- asp.net-core - 如何确定熊令牌失败的原因
- python - Python 曲面绘图
- java - Tomcat 上的其中一个应用程序自动关闭