Use Tailwind CSS in Svelte Components

Tailwind CSS in action

Time to see our work in action and use a Tailwind CSS class in a component. Let’s change the index page’s title to a different color. Click Run and follow the instructions to start the dev serverrunApp and in the src/routes/index.svelte file given below, change the <h1> tag to the following:

<h1 class="text-yellow-600">Great success!</h1>

Click Run again to save the changes and see the title color updated to reflect the Tailwind CSS text-yellow-600 class.

Get hands-on with 1400+ tech skills courses.