Nudge

nudge creates margins to help you move a content towards the center of an element. It can be used by itself or with pos and fixed.


Nudge an element towards the center

nudge moves the element towards the center of its container with the margin property.

index.html
<div class="card">
<div class="nudge [--nudge:0.5rem]"> Nudged element </div>
</div>
<!-- ... other positions ... -->
Nudged element

Combine nudge with other positioning utilities

nudge is incredible when you combine it with pos or fixed.

Imagine you want an element to be positioned on the top right corner, and perhaps nudged a little bit to the center — you can do that with nudge without diving into the nitty gritty CSS details.

index.html
<div class="stack">
<div class="pos-topright nudge-2"> Nudged element </div>
<!-- ... other positions ... -->
</div>
Nudge Amount
0.5rem
Top Left
Top
Top Right
Left
Right
Bottom Left
Bottom
Bottom Right

Perfect inner border radius calulation

While nudging, you can enable automatic inner radius calculation to calculate the perfect border radius, every time!

Nudge Amount
0rem
Top Left
Top
Top Right
Left
Right
Bottom Left
Bottom
Bottom Right

Make interesting cards with nudge

Have you seen cards with backgrounds contained in a slight nudge? Well, you can do that easily too with nudge and the inner border radius option!

Nudge Amount
0.25rem
Nudged Box
Imagine placing an image on the red box to the left. It's a pretty cool effect, isn't it?