【发布时间】:2021-08-27 01:39:13
【问题描述】:
我无法理解如何使用 TailwindCSS 过渡实用程序在此 Angular 组件中执行简单的宽度过渡。例如,下面的按钮通常会显示一个 SVG 图标。但是,有时它会显示一条短信。当显示文本消息而不是 SVG 图标时,按钮的宽度会发生变化。我想为宽度变化添加一个过渡(在两个方向上),但我不知道如何。任何帮助表示赞赏!
<button class="bg-green-600 text-green-100 ring-green-400 p-4 rounded-full focus:outline-none">
<span *ngIf="buttonText" class="font-semibold">{{buttonText}}</span>
<svg *ngIf="!buttonText" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
</button>
【问题讨论】:
标签: css tailwind-css