Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When using component frameworks like React, you typically put the styling for a button in the button component, and use that component. So then you don't need to have a global CSS class for a button. You just need to style the button once in the component.

But with the @apply function it's also still possible to create a new CSS class that combines other Tailwind attributes. That is sometimes useful for within a single component that uses the same styling for multiple elements.

.common-style { @apply flex w-4 h-3 bg-green; }

https://tailwindcss.com/docs/functions-and-directives#apply-...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: