//邊框
@mixin yjbk ($num) {
-moz-border-radius: $num;
-webkit-border-radius: $num;
border-radius: $num;
}
//轉(zhuǎn)塊元素
@mixin block ($width, $height) {
width: $width;
height: $height;
display: block;
}
//轉(zhuǎn)行內(nèi)塊元素
@mixin inline-block ($width, $height) {
width: $width;
height: $height;
display: inline-block;
}
//屏幕中居中
@mixin pm-center {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
//文本省略
@mixin ellipsis($rowCount: 1) {
@if $rowCount <=1 {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} @else {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: $rowCount;
-webkit-box-orient: vertical;
}
}
//三角形()
@mixin sanjiaoxing($size: 5px, $color: rgba(0, 0, 0, 0.6), $dir: bottom) {
width: 0;
height: 0;
border-style: solid;
@if (bottom==$dir) {
border-width: $size $size 0 $size;
border-color: $color transparent transparent transparent;
} @else if (top==$dir) {
border-width: 0 $size $size $size;
border-color: transparent transparent $color transparent;
} @else if (right==$dir) {
border-width: $size 0 $size $size;
border-color: transparent transparent transparent $color;
} @else if (left==$dir) {
border-width: $size $size $size 0;
border-color: transparent $color transparent transparent;
}
}
//元素定位
@mixin postion ($type, $top, $right, $bottom, $left) {
position: $type;
top: $top;
bottom: $bottom;
left: $left;
right: $right;
& > #{$type} {
color: #f00;
}
}
// 隔行換色
@mixin ghhs($evenColor, $evenBgColor, $oddColor, $oddBgColor) {
&:nth-child(2n) {
color: $evenColor;
background-color: $evenBgColor;
}
&:nth-child(2n + 1) {
color: $oddColor;
background-color: $oddBgColor;
}
}
// 禁止文本被選擇
@mixin user-select {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
//修改input placeholder顏色
@mixin placeholderColor($color: #fff) {
&::-webkit-input-placeholder {
color: $color;
}
&::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: $color;
}
&:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: $color;
}
&:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: $color;
}
}
//元素初始化
@mixin elinit ($w: auto,$h: auto,$c: #fff) {
width: $w;
height: $h;
background: $c;
}
//元素居中
@mixin content ($w,$h) {
position: absolute;
width: $w;
height: $h;
top: 50%;
left: 50%;
margin-top: -$h / 2;
margin-left: -$w / 2;
}
//陰影
@mixin boxshadow ($x) {
box-shadow: $x;
}
作者:王三歲805
鏈接:https://juejin.cn/post/7018003395713695780
來源:稀土掘金
著作權(quán)歸作者所有。商業(yè)轉(zhuǎn)載請(qǐng)聯(lián)系作者獲得授權(quán),非商業(yè)轉(zhuǎn)載請(qǐng)注明出處。
常用scss設(shè)置
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- vue項(xiàng)目安裝scss 新建vue 項(xiàng)目 vue init webpack myname 1、cnpm insta...
- Vue項(xiàng)目中使用scss,如果寫了一套完整的有變量的scss文件,全局引入供每個(gè)組件(頁面)使用??梢栽趍ian....
- react 默認(rèn)支持sass 因?yàn)閟ass比less強(qiáng)大 支持全局函數(shù) 1.安裝 sass-resources-l...
- 操作步驟 安裝ruby 環(huán)境 下載ruby installer https://rubyinstaller.org...
- 1、項(xiàng)目中設(shè)置lang=“scss”,運(yùn)行項(xiàng)目報(bào)錯(cuò): Cannot find module'node-sass' ...