过渡与动画
用于控制 CSS 过渡行为的工具。
| Class | Styles |
|---|---|
transition-normal | transition-behavior: normal; |
transition-discrete | transition-behavior: allow-discrete; |
使用 transition-discrete 工具在属性改变为离散值时开始过渡,例如元素从 hidden 变为 block:
通过勾选复选框来查看预期行为
<label class="peer ..."> <input type="checkbox" checked /></label><button class="hidden transition-all not-peer-has-checked:opacity-0 peer-has-checked:block ..."> 我隐藏</button><label class="peer ..."> <input type="checkbox" checked /></label><button class="hidden transition-all transition-discrete not-peer-has-checked:opacity-0 peer-has-checked:block ..."> 我渐隐</button>Prefix a transition-behavior utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<button class="transition-discrete md:transition-normal ..."> <!-- ... --></button>Learn more about using variants in the variants documentation.