SCSS ( @mixin @include )

1. 引入

(1) 安装
https://ithelp.ithome.com.tw/upload/images/20220310/20137684i3zYB8GdCe.png
(2) 记得开启
https://ithelp.ithome.com.tw/upload/images/20220310/20137684YUuO09jxgX.png
(3) 成功编译
https://ithelp.ithome.com.tw/upload/images/20220310/201376845EdMiyQFaP.png


1. 使用

https://5xruby.tw/posts/play-sass-mixin-and-include

定义一个名称,将需要重复使用的 CSS 放在里面

$primary: #248bf1; // $定义变数
@mixin backgroundImageStyle($attachment, $notRepeat: false) {
  background-position: center;
  background-size: cover;
  background-attachment: $attachment;
  // 预设repeat
  @if $notRepeat {
    // 如果true打开
    background-repeat: no-repeat;
  }
}

呼叫使用

body {
  @include backgroundImageStyle(fixed, $notRepeat: false);
  background-image: url("../image/Cyberpunk-featured-movie-bg.jpg");
}

<<:  [Springfox]使用笔记-01

>>:  RWD

第10车厢-你今天table了吗?tableRWD+简易分页应用篇

本篇延续<第9车厢-使用content:attr()实现tableRWD应用>的版,透过程序自动产...

【Day30】App 开发以及中年职涯的选择

参考连结: 40岁软件工程师面试心得 中年大叔的失业危机 要怎麽面对? 中年转职选择: BI大数据v...

01. Laravel x Sail x Mac

Laravel Sail 是 Laravel 8 的新功能,你可以透过 sail 指令来操作内建的 ...

iOS APP 开发 OC 第十一天,使用 typedef 简化 block

tags: OC 30 day 问题:简化block变量的时候,要写好大一串,类型好长。 typed...

Alpine Linux Porting (一点一?)

要作Alpine的新平台porting,其实在有了 aports/script/bootstrap....