【发布时间】:2023-04-04 02:00:01
【问题描述】:
请任何帮助我想用 scss im 使用 mixin 创建一个动态的三角形方向,但它对我不起作用
文件 HTML
<div class="arrow-div">Arrow</div>
scss 文件
.arrow-div{
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
width: 300px;
height: 300px;
margin: 50px auto;
border:1px solid #ccc;
position: relative;
@include arrow(red,-40px,null,null,50%,top,translateX(-50%));
}
@mixin arrow($color,$top,$right,$bottom,$left,$dir,$translate){
position:absolute;
content:"";
border: 20px solid transparent;
position:$dir;
top:$top;
right:$right;
bottom:$bottom;
left:$left;
transform: $translate;
border-#{$dir}-color: $color;
}
【问题讨论】:
-
老实说,我只会使用 SVG 并根据方向旋转它。
标签: html variables sass scss-mixins