Loading tutorials
Intermediate · Mid: 13 chapters · 34 min read. States assumed prerequisites
Start readingflex, px-4, and bg-blue-500, and the idea of a component or template partial. Its goal is to help you tell real duplication from repetition that is harmless.flex, px-4, and bg-blue-500. It also assumes you have used a loop or a partial in a template language or a component framework. Not every repeated class list needs a new abstraction. Sometimes the repetition exists only in the filepx-4 and bg-blue-600, and the basics of a component framework such as React. It covers the main way to reuse Tailwind styles: move repeated markup and classes into one component.Button component from the previous chapter.px-4 and bg-blue-600, and the idea of a component or template partial. It covers the @apply directive: what it does, how to write a class with it, and where it stops being useful.@apply in the previous chapter. Here you will see where component classes should live and why that placement matters.@apply directive and @layer components from the previous chapters, and that you have used variants such as hover: and md: in markup. Here you will see how variants behave when you move them into CSS.@apply works in a global stylesheet, that you have used Tailwind utilities, and that you have written a component in Vue, Svelte, or a similar framework. It covers why @apply can fail in a component's own stylesheet and how to fix that in Tailwind CSS v4.@apply directive, and the @layer components pattern from earlier chapters. It also assumes you know what a variant such as hover: or md: does.@layer components pattern, and basic component-based UI. It covers where @apply causes trouble and how to avoid it.