Filters
用于对元素应用阴影滤镜的工具类。
| Class | Styles |
|---|---|
drop-shadow-xs | filter: drop-shadow(var(--drop-shadow-xs)); /* 0 1px 1px rgb(0 0 0 / 0.05) */ |
drop-shadow-sm | filter: drop-shadow(var(--drop-shadow-sm)); /* 0 1px 2px rgb(0 0 0 / 0.15) */ |
drop-shadow-md | filter: drop-shadow(var(--drop-shadow-md)); /* 0 3px 3px rgb(0 0 0 / 0.12) */ |
drop-shadow-lg | filter: drop-shadow(var(--drop-shadow-lg)); /* 0 4px 4px rgb(0 0 0 / 0.15) */ |
drop-shadow-xl | filter: drop-shadow(var(--drop-shadow-xl); /* 0 9px 7px rgb(0 0 0 / 0.1) */ |
drop-shadow-2xl | filter: drop-shadow(var(--drop-shadow-2xl)); /* 0 25px 25px rgb(0 0 0 / 0.15) */ |
drop-shadow-none | filter: drop-shadow(0 0 #0000); |
drop-shadow-(<custom-property>) | filter: drop-shadow(var(<custom-property>)); |
drop-shadow-[<value>] | filter: drop-shadow(<value>); |
使用 drop-shadow-sm 和 drop-shadow-xl 等工具类为元素添加投影:
drop-shadow-md
drop-shadow-lg
drop-shadow-xl
<svg class="drop-shadow-md ..."> <!-- ... --></svg><svg class="drop-shadow-lg ..."> <!-- ... --></svg><svg class="drop-shadow-xl ..."> <!-- ... --></svg>这对于为不规则形状(如文本和SVG元素)添加阴影非常有用。如果要为常规元素添加阴影,你可能需要使用 盒子阴影。
Use the drop-shadow-[<value>] syntax to set the 投影 based on a completely custom value:
<svg class="drop-shadow-[0_35px_35px_rgba(0,0,0,0.25)] ..."> <!-- ... --></svg>For CSS variables, you can also use the drop-shadow-(<custom-property>) syntax:
<svg class="drop-shadow-(--my-drop-shadow) ..."> <!-- ... --></svg>This is just a shorthand for drop-shadow-[var(<custom-property>)] that adds the var() function for you automatically.
Prefix a filter: drop-shadow() utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<svg class="drop-shadow-md md:drop-shadow-xl ..."> <!-- ... --></svg>Learn more about using variants in the variants documentation.
Use the --drop-shadow-* theme variables to customize the drop shadow utilities in your project:
@theme { --drop-shadow-3xl: 0 35px 35px rgba(0, 0, 0, 0.25); }Now the drop-shadow-3xl utility can be used in your markup:
<svg class="drop-shadow-3xl"> <!-- ... --></svg>Learn more about customizing your theme in the theme documentation.