html - Sass:“.divTable-100%”之后的无效 CSS:预期的占位符名称,是“”
问题描述
请问,你对 Sass 源代码有什么问题有什么建议吗?
我想动态更改表格宽度。但是出现了错误:
错误:“.divTable-100%”后的 CSS 无效:预期占位符名称,在第 18 行是“”...
谢谢 !
$tableWidth: () !default;
$tableWidth: map-merge(
(
"large": 100%,
"medium": 75%,
"small": 50%,
"extraSmall": 25%
),
$tableWidth
);
@mixin tableStyles {
margin-top: 25px;
display: table;
color: $tableColor;
border: $clBtnBorder;
}
@each $size, $size in $tableWidth {
.divTable-#{$size} {
width: $size !important;
@include tableStyles;
}
}
解决方案
% 不是 class name 的有效字符,因为您使用的是 map ,所以将键用作类的名称,将值用作 CSS 值。希望这可以帮助。
$tableWidth: () !default;
$tableWidth: map-merge(
(
"large": 100%,
"medium": 75%,
"small": 50%,
"extraSmall": 25%
),
$tableWidth
);
@mixin tableStyles {
margin-top: 25px;
display: table;
color: $tableColor;
border: $clBtnBorder;
}
@each $name, $size in $tableWidth {
.divTable-#{$name} {
font-size: $size;
height: $size;
width: $size;
}
}
推荐阅读
- java - 使用没有图像的 PDFBox 将 PDF 转换为灰度?
- java - 在当前视图中的所有其他内容上显示一个片段,然后在单击按钮时将其删除
- vba - 循环通过一个案例语句
- node.js - 如何从 lambda 正确运行二进制文件?
- python - 如何使用 Maya python 列出一个节点属性的所有值?
- python - Python 3:如何比较两个元组并找到相似的值?
- python - 如何创建尽可能少的剩余零?
- python - Python/RE 将 tnsnames.ora 解析为连接字符串
- shell - 与同一文件夹中的多个文件交互,仅写入一次路径
- php - How do i get my data from mysql to behave