scss Mixin在SASS中添加三角形
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss Mixin在SASS中添加三角形相关的知识,希望对你有一定的参考价值。
/*
* @include triangle within a pseudo element and add positioning properties (ie. top, left)
* $direction: up, down, left, right
*/
@mixin triangle($direction, $size: 6px, $color: #222) {
content: "";
display: block;
position: absolute;
height: 0;
width: 0;
@if ($direction== "up") {
border-bottom: $size solid $color;
border-left: 1/2 * $size solid transparent;
border-right: 1/2 * $size solid transparent;
} @else if ($direction== "down") {
border-top: $size solid $color;
border-left: 1/2 * $size solid transparent;
border-right: 1/2 * $size solid transparent;
} @else if ($direction== "left") {
border-top: 1/2 * $size solid transparent;
border-bottom: 1/2 * $size solid transparent;
border-right: $size solid $color;
} @else if ($direction== "right") {
border-top: 1/2 * $size solid transparent;
border-bottom: 1/2 * $size solid transparent;
border-left: $size solid $color;
}
}
以上是关于scss Mixin在SASS中添加三角形的主要内容,如果未能解决你的问题,请参考以下文章
scss Sass mixin可快速添加渐变
scss Sass mixin可轻松将视网膜图像添加到CSS属性中
scss Sass:Font Awesome:在mixin之后
scss sass_vertical-ALIGN-mixin.scss
scss SASS,SCSS,mixin:PX到EM的转换
scss Mixin Media查询段SASS