Home > OS >  How to use the `margin: y x;` shorthand in Tailwind?
How to use the `margin: y x;` shorthand in Tailwind?

Time:12-09

In Tailwind CSS if I use a utility for calc such as:

right-[calc(-50vw 50%)]

this works as expected. I have some attributes I am trying to add to an element but can't seem to figure out how to get it work using tailwind utilities:

 .element {
    width: 100vw;
    max-width: 100vw;
    margin: 0 calc(-50vw   50%);
  }

CodePudding user response:

Use my and mx:


CodePudding user response:

<div >
  
</div>

This will apply the calc() function to the margin-left and margin-right utilities, allowing you to use it to calculate the margin values. This will produce the same result as the original CSS code provided.

  • Related