csstailwind-css

How to convert background-position: % in Tailwind


Didn't find a way to convert
background-position: 0% 20%;
in tailwind

I only find these classes bg-{side}

any help is appreciated


Solution

  • If you're using the new just-in-time (JIT) mode, you can generate this class on the fly.

    Then you can just use: bg-[0% 20%]. The square brackets just mean that this is an arbitrary value that isn't in the config.

    Here are the docs for JIT mode.

    https://tailwindcss.com/docs/just-in-time-mode