- CSS 教程
- CSS - 首頁
- CSS - 路線圖
- CSS - 簡介
- CSS - 語法
- CSS - 選擇器
- CSS - 包含
- CSS - 測量單位
- CSS - 顏色
- CSS - 背景
- CSS - 字型
- CSS - 文字
- CSS - 圖片
- CSS - 連結
- CSS - 表格
- CSS - 邊框
- CSS - 塊級邊框
- CSS - 內聯邊框
- CSS - 外邊距
- CSS - 列表
- CSS - 內邊距
- CSS - 游標
- CSS - 輪廓
- CSS - 尺寸
- CSS - 捲軸
- CSS - 行內塊
- CSS - 下拉選單
- CSS - 可見性
- CSS - 溢位
- CSS - Clearfix
- CSS - 浮動
- CSS - 箭頭
- CSS - 可調整大小
- CSS - 引號
- CSS - 順序
- CSS - 定位
- CSS - 連字元
- CSS - 懸停
- CSS - 顯示
- CSS - 聚焦
- CSS - 縮放
- CSS - 位移
- CSS - 高度
- CSS - 連字元字元
- CSS - 寬度
- CSS - 不透明度
- CSS - Z-Index
- CSS - 底部
- CSS - 導航欄
- CSS - 覆蓋層
- CSS - 表單
- CSS - 對齊
- CSS - 圖示
- CSS - 圖片庫
- CSS - 註釋
- CSS - 載入器
- CSS - 屬性選擇器
- CSS - 組合器
- CSS - 根元素
- CSS - 盒模型
- CSS - 計數器
- CSS - 剪裁
- CSS - 書寫模式
- CSS - Unicode-bidi
- CSS - min-content
- CSS - 全部
- CSS - 內嵌
- CSS - 隔離
- CSS - 溢位滾動
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - 指標事件
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - 最大塊級尺寸
- CSS - 最小塊級尺寸
- CSS - 混合模式
- CSS - 最大內聯尺寸
- CSS - 最小內聯尺寸
- CSS - 偏移
- CSS - 重音色
- CSS - 使用者選擇
- CSS 高階
- CSS - 網格
- CSS - 網格佈局
- CSS - Flexbox
- CSS - 可見性
- CSS - 定位
- CSS - 層
- CSS - 偽類
- CSS - 偽元素
- CSS - @規則
- CSS - 文字效果
- CSS - 分頁媒體
- CSS - 列印
- CSS - 佈局
- CSS - 驗證
- CSS - 圖片精靈
- CSS - !important
- CSS - 資料型別
- CSS3 教程
- CSS3 - 教程
- CSS - 圓角
- CSS - 邊框圖片
- CSS - 多重背景
- CSS - 顏色
- CSS - 漸變
- CSS - 盒陰影
- CSS - 盒裝飾中斷
- CSS - 游標顏色
- CSS - 文字陰影
- CSS - 文字
- CSS - 二維變換
- CSS - 三維變換
- CSS - 過渡
- CSS - 動畫
- CSS - 多列
- CSS - 盒尺寸
- CSS - 工具提示
- CSS - 按鈕
- CSS - 分頁
- CSS - 變數
- CSS - 媒體查詢
- CSS - 函式
- CSS - 數學函式
- CSS - 遮罩
- CSS - 形狀
- CSS - 樣式圖片
- CSS - 特異性
- CSS - 自定義屬性
- CSS 響應式
- CSS RWD - 簡介
- CSS RWD - 視口
- CSS RWD - 網格檢視
- CSS RWD - 媒體查詢
- CSS RWD - 圖片
- CSS RWD - 影片
- CSS RWD - 框架
- CSS 工具
- CSS - PX 到 EM 轉換器
- CSS - 顏色選擇器和動畫
- CSS 資源
- CSS - 有用資源
- CSS - 討論
CSS - mix-blend-mode 屬性
CSS mix-blend-mode 屬性決定了元素的內容應該如何與其父元素的內容以及元素的背景內容混合。
語法
mix-blend-mode: normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | difference | exclusion | hue | saturation | color | luminosity;
屬性值
| 值 | 描述 |
|---|---|
| normal | 不發生混合。 |
| multiply | 透過將背景色和前景顏色相乘來使顏色變暗。 |
| screen | 透過反轉、相乘,然後再次反轉來使顏色變亮。 |
| overlay | 它結合了 multiply 和 screen,保留了高光和陰影。 |
| darken | 它保留重疊元素中較暗的顏色。 |
| lighten | 它保留重疊元素中較亮的顏色。 |
| color-dodge | 透過降低元素的顏色來使背景變亮。 |
| color-burn | 透過增加元素的顏色來使背景變暗。 |
| difference | 它減去顏色以建立高對比度效果。 |
| exclusion | 它類似於 difference,但對比度效果更柔和。 |
| hue | 它保留亮度和飽和度,只改變色相。 |
| saturation | 它保留亮度和色相,只改變飽和度。 |
| color | 它將元素的色相和飽和度與亮度相結合。 |
| luminosity | 它保留色相和飽和度,只改變亮度。 |
CSS 混合模式屬性示例
以下示例使用不同的值解釋了mix-blend-mode屬性。
使用 normal 值的混合模式屬性
為了防止元素與其他圖層互動,我們使用normal值。元素按原樣呈現,不會與底層圖層有任何互動。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: normal;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: normal
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 multiply 值的混合模式屬性
為了將背景色和前景顏色相乘,從而產生較暗的顏色,我們使用multiply值。它會產生豐富的陰影。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: multiply;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: multiply
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 screen 值的混合模式屬性
為了透過反轉兩層、相乘然後反轉結果來使顏色變亮,我們使用screen值。它會產生增亮效果。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: screen;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: screen
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 overlay 值的混合模式屬性
為了透過使暗區變暗和使亮區變亮來增強對比度,我們使用overlay值。它結合了 multiply 和 screen,保留了高光和陰影。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: overlay;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: overlay
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 darken 值的混合模式屬性
為了比較背景色和前景顏色,保留較暗的顏色,我們使用darken值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: darken;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: darken
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 lighten 值的混合模式屬性
為了保留重疊元素中較亮的顏色,我們使用lighten值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: lighten;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: lighten
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 color-dodge 值的混合模式屬性
為了透過降低前景顏色的強度來使背景變亮,我們使用color-dodge值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: color-dodge;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: color-dodge
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 color-burn 值的混合模式屬性
為了透過增加前景顏色的強度來使背景變暗,我們使用color-burn值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: color-burn;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: color-burn
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 difference 值的混合模式屬性
為了減去重疊圖層的顏色,從而產生高對比度效果,我們使用difference值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: difference;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: difference
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 exclusion 值的混合模式屬性
為了減去重疊圖層的顏色,從而產生柔和的對比度效果,我們使用exclusion值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: exclusion;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: exclusion
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 hue 值的混合模式屬性
為了保留背景的亮度和飽和度,同時只改變元素的色相,我們使用hue值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: hue;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: hue
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 saturation 值的混合模式屬性
為了保留亮度和色相,只修改元素的飽和度,我們使用saturation值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: saturation;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: saturation
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 color 值的混合模式屬性
為了將元素的色相和飽和度與背景的亮度相結合,我們使用color值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: color;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: color
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
使用 luminosity 值的混合模式屬性
為了保留元素的色相和飽和度,只改變亮度,我們使用luminosity值。以下示例顯示了這一點。
示例
<!DOCTYPE html>
<html>
<head>
<style>
.container {
background-color: #6666ff;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.container>img {
mix-blend-mode: luminosity;
}
</style>
</head>
<body>
<h2>
CSS mix-blend-mode property
</h2>
<h4>
mix-blend-mode: luminosity
</h4>
<div class="container">
<img src="/css/images/content.png"
alt="img" height=250 width=300/>
</div>
</body>
</html>
支援的瀏覽器
| 屬性 | ![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|---|
| mix-blend-mode | 41.0 | 79.0 | 32.0 | 8.0 | 35.0 |




