1. 效果
  2. background-blend-mode

效果

background-blend-mode

Utilities for controlling how an element's background image should blend with its background color.

样式
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;

示例(Examples)

¥Examples

基本示例(Basic example)

¥Basic example

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

¥Use utilities like bg-blend-difference and bg-blend-saturation to control how the background image and color of an element are blended:

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>

响应式设计(Responsive design)

¥Responsive design

background-blend-mode 工具前面使用断点变体如 md: 仅在 medium 屏幕尺寸及以上时应用工具:

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

请参阅 变体文档 详细了解如何使用变体。

TailwindCSS v4.0 中文网 - 粤ICP备13048890号