css - 如何将文字字符串注入 scss @mixin
问题描述
考虑以下 scss 代码:
@mixin homeSlider(
$dim: 150px,
$h1: "h1 { font-size: 4em; margin-top: 0; }"
){
section {
margin-top: -$dim;
}
$h1;
}
@include homeSlider( $dim: 50px, $h1: "h1 { font-size: 3em; margin-top: 0; }" )
我需要知道如何实现我的目标
解决方案
尝试这个
@mixin homeSlider($dim, $h1-font-size){
section {
margin-top: -$dim;
h1 {
font-size: $h1-font-size;
margin-top: 0;
}
}
}
@include homeSlider(50px, 3em;) /* $dim = 50px - $h1-font-size = 3em; */
推荐阅读
- ubuntu - Kerberos 服务启动时出现错误:无法在 Ubuntu 18 上打开 DB2 数据库
- assembly - 汇编中的 x86 实模式分段
- reactjs - 盖茨比 | 更新表单时反应组件闪烁
- python - 将 main.py 更改为 __init__.py 后 app.yaml 无法找到入口点
- java - 如何使while循环检查字符串中是否有16位数字
- python - 如何从 extract_first() 输出中删除 xpath?
- macos - 如何在 MacOS WKWebView 中支持 WebAuthN?
- python-3.x - 如何解决熊猫中的“用户警告:未应用紧密布局:子图规范中的列数必须是彼此的倍数”
- google-cloud-platform - 将二进制数据从 Google Cloud Storage 流式传输到 Cloud Function
- c# - 我如何知道 C# Unity 中 AndroidJavaObject 类中的方法