效果
控制元素如何与背景混合的工具类。
Class | Styles |
---|---|
mix-blend-normal | mix-blend-mode: normal; |
mix-blend-multiply | mix-blend-mode: multiply; |
mix-blend-screen | mix-blend-mode: screen; |
mix-blend-overlay | mix-blend-mode: overlay; |
mix-blend-darken | mix-blend-mode: darken; |
mix-blend-lighten | mix-blend-mode: lighten; |
mix-blend-color-dodge | mix-blend-mode: color-dodge; |
mix-blend-color-burn | mix-blend-mode: color-burn; |
mix-blend-hard-light | mix-blend-mode: hard-light; |
mix-blend-soft-light | mix-blend-mode: soft-light; |
mix-blend-difference | mix-blend-mode: difference; |
mix-blend-exclusion | mix-blend-mode: exclusion; |
mix-blend-hue | mix-blend-mode: hue; |
mix-blend-saturation | mix-blend-mode: saturation; |
mix-blend-color | mix-blend-mode: color; |
mix-blend-luminosity | mix-blend-mode: luminosity; |
mix-blend-plus-darker | mix-blend-mode: plus-darker; |
mix-blend-plus-lighter | mix-blend-mode: plus-lighter; |
使用像 mix-blend-overlay
和 mix-blend-soft-light
这样的工具类来控制元素的内容和背景与同一堆叠上下文中的其他内容如何混合:
<div class="flex justify-center -space-x-14"> <div class="bg-blue-500 mix-blend-multiply ..."></div> <div class="bg-pink-500 mix-blend-multiply ..."></div></div>
在父元素上使用 isolate
工具类来创建一个新的堆叠上下文,并防止与其后面的内容混合:
<div class="isolate flex justify-center -space-x-14"> <div class="bg-yellow-500 mix-blend-multiply ..."></div> <div class="bg-green-500 mix-blend-multiply ..."></div></div><div class="flex justify-center -space-x-14"> <div class="bg-yellow-500 mix-blend-multiply ..."></div> <div class="bg-green-500 mix-blend-multiply ..."></div></div>
Prefix a mix-blend-mode
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="mix-blend-multiply md:mix-blend-overlay ..."> <!-- ... --></div>
Learn more about using variants in the variants documentation.