Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement background-position-x and background-position-y utilities?

Tags:

tailwind-css

I'm trying to make my background image responsive using TailwindCSS. Can't find background-position-x and background-position-y utilities in documentation. How can I implement them?

like image 722
Chris Avatar asked Nov 29 '25 09:11

Chris


1 Answers

At the moment, TailwindCSS doesn't have a utility for this. Except for adding it as a utility either by a plugin or in CSS, if you're using the JIT Mode, the shortest way to do this is adding it as an arbitrary property.

For example adding this: [background-position-x:-100px] will generate:

.\[background-position-x\:-100px\] {
  background-position-x: -100px;
}
like image 184
eripanci Avatar answered Dec 02 '25 03:12

eripanci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!