2 回答
TA贡献1775条经验 获得超8个赞
您需要从您的代码中检索 var,就像您对另一个代码所做的那样: #{$retina-phone}
那么结果是:
$min-phone: 320px;
$retina-phone: #{"only screen and (min-width: #{$min-phone})"};
p {
@media #{$retina-phone} {
font-size: 12;
}
}
它将编译为
@media only screen and (min-width: 320px) {
p {
font-size: 12;
}
}
TA贡献1876条经验 获得超6个赞
您可以创建@mixin:
@mixin respond-below($breakpoint) {
// If the breakpoint exists in the map.
@if map-has-key($breakpoints, $breakpoint) {
// Get the breakpoint value.
$breakpoint-value: map-get(
$breakpoints,
$breakpoint
); // Write the media query.
@media (max-width: ($breakpoint-value - 1)) {
@content;
}
// If the breakpoint doesn't exist in the map.
} @else {
// Log a warning.
@warn "Invalid breakpoint: #{$breakpoint}.";
}
}
- 2 回答
- 0 关注
- 97 浏览
添加回答
举报