🫥

A simple guide to using tailwindcss transition-opacity

This article was automatically translated from theJapanese original by AI. It may contain translation errors.

This post was published over 1 year ago. Its content may be outdated.

Introduction

Using transitions, you can easily implement soft, subtle animations.
Transitions let you create a design that’s a step above the rest.

How to use transition-opacity

To simply change an element’s opacity, use transition-opacity.
transition-opacity is defined internally like this.

Definition of transition-opacity

<button className="opacity-100 hover:opacity-0 transition-opacity">🖥️ Software</button>

Design sample with transition-opacity applied
We got an animation that fades out softly.
If you want to change the fade-out speed, define something like duration-300 in className.\

For background color

To change the opacity of a background color, it becomes a color transition, so use transition-colors.
In tailwindcss it’s defined like this.

Definition of transition-colors

You use it like this.

<button className="hover:bg-black hover:bg-opacity-5 transition-colors">🖥️ Software</button>

Design sample with transition-colors applied

There are many other transitions as well.\

Recent Articles

Network(beta)

Drag to move / Ctrl+wheel to zoom