In this lesson, we learn how to target specific states of elements and apply styles only when those states are triggered.
Instructor: Let's take a text link and a button. These look nice, but we should apply different styles on hover. In Tailwind, you can target hover states with the hover prefix followed by a colon. On hover, we want the text to be orange.
Let's do the same with the button. On hover, we want the button background to be black. Here we go. Let's style the focus state for our text link now. Let's give that a try. When I click on the link, the focus state styles are applied. When I click out, they are removed.
You must be a Pro Member to view code
Access all courses and lessons, track your progress, gain confidence and expertise.