Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple transform function on Tailwind CSS

Tags:

tailwind-css

I would like to apply several tranform functions to Tailwind CSS for one element order from left to right like this :

transform: rotate(45deg) translateX(50%);

But if I apply class like this, rotation is applied last.

class="transform rotate-45 translate-x-1/2"

A link to illustrate my problem :
Play.tailwindcss.com/R6PBP2OHPy

like image 302
TheMilion Avatar asked Aug 11 '26 11:08

TheMilion


1 Answers

I solved this by rotating the parent div element and translating the child element. Not the most elegant solution but it works.

<div class="rotate-45">
  <img class="translate-x-12"/>
</div>

https://play.tailwindcss.com/dvZnRRaKq1

like image 109
Nic Ballesteros Avatar answered Aug 14 '26 10:08

Nic Ballesteros



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!