
- 語言特性
- Less - 巢狀規則
- Less - 巢狀指令和冒泡
- Less - 操作
- Less - 轉義
- Less - 函式
- Less - 名稱空間和訪問器
- Less - 範圍
- Less - 註釋
- Less - 匯入
- Less - 變數
- Less - 擴充套件
- Less - 混合宏
- Less - 引數化混合宏
- Less - 混合宏作為函式
- Less - 將規則集傳遞給混合宏
- Less - 匯入指令
- Less - 匯入選項
- Less - 混合宏保護
- Less - CSS 保護
- Less - 迴圈
- Less - 合併
- Less - 父選擇器
- 函式
- Less - 雜項函式
- Less - 字串函式
- Less - 列表函式
- Less - 數學函式
- Less - 型別函式
- Less - 顏色定義函式
- Less - 顏色通道函式
- Less - 顏色操作
- Less - 顏色混合函式
- 用法
- Less - 命令列用法
- 在瀏覽器中使用 Less
- Less - 瀏覽器支援
- Less - 外掛
- Less - 程式化用法
- Less - 線上編譯器
- Less - GUI
- Less - 編輯器和外掛
- Less - 第三方編譯器
- Less - 框架
- Less 有用資源
- Less - 快速指南
- Less - 有用資源
- Less - 討論
LESS - 顏色混合排除函式
描述
exclusion 函式的工作原理類似於 difference 函式,但對比度較低。
引數
color1 − 一個充當被減數的顏色物件。
color2 − 一個充當減數的顏色物件。
返回值
color
示例
以下示例演示了在 LESS 檔案中使用exclusion 函式:
<html> <head> <link rel = "stylesheet" href = "style.css" type = "text/css" /> </head> <body> <h2>Exclusion Function</h2> <div class = "color1"> <p>(color1) <br> #ff6600</p> </div><br> <div class = "color2"> <p>(color2) <br> #333333</p> </div><br> <div class = "res"> <p>(result) <br> #cc7033</p> </div> </body> </html>
接下來,建立style.less 檔案。
style.less
.color1 { width: 100px; height: 100px; background-color: #ff6600; } .color2 { width: 100px; height: 100px; background-color: #333333; } .res { width: 100px; height: 100px; background-color: exclusion(#ff6600, #333333); } p { padding: 30px 0px 0px 25px; }
您可以使用以下命令將style.less 編譯為style.css:
lessc style.less style.css
執行上述命令;它將自動建立style.css 檔案,其中包含以下程式碼:
style.css
.color1 { width: 100px; height: 100px; background-color: #ff6600; } .color2 { width: 100px; height: 100px; background-color: #333333; } .result { width: 100px; height: 100px; background-color: #cc7033; } p { padding: 30px 0px 0px 25px; }
輸出
請按照以下步驟檢視上述程式碼的工作原理:
將以上程式碼儲存到color_blending_exclusion.html 檔案中。
在瀏覽器中開啟此 HTML 檔案,將顯示以下輸出。

less_color_blending_functions.htm
廣告