Sass(scss)常用語法記錄

2021-09-27 08:20:31 字數 1396 閱讀 4019

scss 需要使用分號和花括號。

sass舉例:

#sidebar

width: 30%

background-color: #faa

scss舉例:

#sidebar

$開頭,後為變數名;

$red: #1875e7; 

div

!default為預設值(使用之前變數已賦值,就不用預設值,如果沒有,則使用預設值)

$content:"softwhy.com";

$content: "antzone" !default;

#main

這時content值為softwhy.com。

在巢狀的**塊內,可以使用&引用父元素。

div 

&:hover

}

使用@at-root跳出選擇器巢狀

.parent

}編譯結果為

.child

使用@extend命令:繼承另外乙個選擇器所有的樣式

.class1 

.class2

使用@mixin命令,定義乙個**塊。使用@include命令進行呼叫。

進行**重用,可傳遞引數。

@mixin border($vert, $horz, $radius: 10px) -#-radius: $radius;

-moz-border-radius-##: $radius;

-webkit-border-#-#-radius: $radius;

}#footer

條件語句(@if, @else)
@if $value> 3  @else
三目判斷

語法為:if($condition, $if_true, $if_false) 。

三個引數分別表示:條件,條件為真的值,條件為假的值。

$boolean:false;

.border

自定義函式
@function double($n) 

#sidebar

for迴圈,while迴圈,each迴圈

參考文件:

vue常用語法記錄

一 本地儲存 localstorage.setitem name this.name localstorage.getitem name this.name 二 axios同時執行多個請求 axios.all axios.get axios.get then axios.spread functio...

mysql常用語法 MySQL常用語法

更新資料 update 表名 set 健名 更改的值 where 建 刪除資料 delete from 表名 where 索引 create index 索引名稱 on 表名 鍵名 建立試圖 create view 檢視名 鍵,鍵 as select matchno,abs won lost fro...

mysql基本常用語法 mysql 常用語法

1.1.開啟 service mysql start 1.2.關閉 service mysql stop 1.3.重啟 service mysql restart 2.1.密碼明文 語法 mysql u使用者名稱 p使用者密碼 舉例 mysql uroot p123456 2.2.密碼密文 語法 m...