1. 效果
  2. 背景混合模式

效果

背景混合模式

用于控制元素的背景图像如何与其背景颜色混合的工具类。

ClassStyles
bg-blend-normal
background-blend-mode: normal;
bg-blend-multiply
background-blend-mode: multiply;
bg-blend-screen
background-blend-mode: screen;
bg-blend-overlay
background-blend-mode: overlay;
bg-blend-darken
background-blend-mode: darken;
bg-blend-lighten
background-blend-mode: lighten;
bg-blend-color-dodge
background-blend-mode: color-dodge;
bg-blend-color-burn
background-blend-mode: color-burn;
bg-blend-hard-light
background-blend-mode: hard-light;
bg-blend-soft-light
background-blend-mode: soft-light;

示例

基本示例

使用像 bg-blend-differencebg-blend-saturation 的工具类来控制元素的背景图像和颜色的混合方式:

bg-blend-multiply

bg-blend-soft-light

bg-blend-overlay

<div class="bg-blue-500 bg-[url(/img/mountains.jpg)] bg-blend-multiply ..."></div>
<div class="bg-blue-500 bg-[url(/img/mountains.jpg)] bg-blend-soft-light ..."></div>
<div class="bg-blue-500 bg-[url(/img/mountains.jpg)] bg-blend-overlay ..."></div>

响应式设计

Prefix a background-blend-mode utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<div class="bg-blue-500 bg-[url(/img/mountains.jpg)] bg-blend-lighten md:bg-blend-darken ...">
<!-- ... -->
</div>

Learn more about using variants in the variants documentation.