admin管理员组文章数量:1336089
Is there a way to do a minimum margin in tailwind similar to w-min, I can't find it in the docs. I am looking for the margin to be 1/5 of the screen but a minimum of 12 (units).
Is there a way to do a minimum margin in tailwind similar to w-min, I can't find it in the docs. I am looking for the margin to be 1/5 of the screen but a minimum of 12 (units).
Share asked Mar 23, 2022 at 0:00 Michael ThomasMichael Thomas 681 silver badge10 bronze badges1 Answer
Reset to default 9You can use arbitary values to specify the max()
value.
e.g.) According to your spec, 1/5
of the screen is 20vw
(or 20vh
for height). and 12 units (guessing in pixels?) as 12px
.
If you do, mx-[max(20vw,12px)]
, it will generate the following rule,
.mx-\[max\(20vw\2c 12px\)\] {
margin-left: max(20vw,12px);
margin-right: max(20vw,12px);
}
max() lets you choose whichever is bigger.
So if 20vw
is less than 12px
, then 12px
margin will be used, and vice versa.
You can use all variations of margin utilities such as m-*
, my-*
, m[lrtb]-*
as well.
本文标签: javascriptMinimum Margin in TailwindStack Overflow
版权声明:本文标题:javascript - Minimum Margin in Tailwind - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742403895a2468428.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论