Tailwind:Functions
lastmod 2024-03-09created 2024-03-092 edits
theme()
Use the theme() function to access your Tailwind config values using dot notation.
This can be a useful alternative to @apply when you want to reference a value from your theme configuration for only part of a declaration.
If you need to access a value that contains a dot (like the 2.5 value in the spacing scale), you can use square bracket notation.
Since Tailwind defines its default color palette using a nested object syntax, you need to use dot notation to access nested colors.
Don't use the dash syntax when accessing nested color values
Use dot notation to access nested color values
screen()
The screen function lets you create media queries that reference your breakpoints by name instead of duplicating their values in your own CSS.
This resolves to the underlying screen value at build time, generating a regular media query that matches the specified breakpoint.
See also
- Tailwind
- Tailwind:Base
- Tailwind:Components
- Tailwind:Utilities
- Tailwind:Directives
- Tailwind:Functions