Skip to content

Position

Position utilities set position (static, relative, absolute, fixed, sticky) and place absolute children with top-*, bottom-*, start-* and end-* at 0, 50 or 100. translate-middle, translate-middle-x and translate-middle-y centre an element on its point, which is how badges and status indicators sit on buttons and avatars.

1Edge positions

top-0, top-50, top-100 with start-0, start-50, start-100 place absolute children on a grid of nine points.

1 2 3 4 5 6

2Centre with translate-middle

translate-middle shifts an element back by half its size so its centre sits on the point.

TL T TR L C R BL B BR

3Notification badge on a button

position-relative on the button, translate-middle on the counter at top-0 start-100.

4Online indicator on an avatar

The indicator sits at bottom-0 end-0 of a position-relative wrapper.

Amara AshfordOnline Tariq IbrahimBusy Jonah OkaforOffline

5Count badge on an avatar

A number badge at top-0 start-100 with translate-middle on a square avatar.

Theo Hughes 19

6Ribbon on a card

An absolutely placed label at top-0 end-0 of a card.

Vet care -17%
Vet care
$63.88

7Stretched link

stretched-link on the link makes the whole position-relative card clickable.

Hope starts with you

We have helped more than two hundred thousand people since we started.

Read the story

8Sticky top inside a scroll area

sticky-top keeps a header visible while its scroll container moves.

Section A (sticky-top)

Our annual report is independently audited and published in full. Our team has done this many times, so you never have to guess.

You receive photos and updates showing exactly what your donation achieved. Volunteers give their time in schools, shelters and food banks every week.

Thousands of donors already trust us, and we work hard to keep it that way. Clean water wells are built with and maintained by local communities.

Friendly people answer your questions quickly, by phone, chat or email. Companies can match employee donations and double their impact.

9position-sticky with a custom offset

position-sticky plus top-0 on a table header row inside a scroll box.

ItemPrice
Tree planting$5.51
Vet care$39.18
Tree planting$7.07
Clean water well$16.76
Solar lamp$52.93
Emergency fund$18.83

10Caption over an image

position-absolute bottom-0 start-0 with margin places a label on the photo corner.

Dublin Kyoto

11Play button centred on a video

top-50 start-50 translate-middle centres the play button on the poster image.

Video poster

12Step progress with positioned dots

A line with translate-middle steps positioned at start-0, start-50 and start-100.

1 2 3

13Close button in the corner

A btn-close at top-0 end-0 with a small margin.

Stand with families in need
Start in minutes and get help from a real person whenever you need it.

14Icon inside an input

An icon at top-50 translate-middle-y on the start of a padded input.

15Tooltip arrow label

A label positioned above an element with bottom-100 start-50 translate-middle-x.

14 saved

16Fixed and sticky classes (preview)

fixed-top, fixed-bottom and sticky-top attach bars to the viewport; here they are previewed as static boxes with position-static.

fixed-top - pins a bar to the top of the viewport
sticky-top - sticks after scrolling to it
fixed-bottom - pins a bar to the bottom
sticky-md-top - sticky from md up

17Overlay covering a card

position-absolute top-0 start-0 w-100 h-100 covers the card with a loading layer.

Meet the partners behind our water projects

We measure success by how many donors come back and tell their friends. Monthly gifts let us plan ahead and respond quickly when disaster strikes.

Loading

18Map pin

A pin positioned at percentage offsets with bottom-50 and translate-middle-x.

Map of Lisbon Kyoto

19Vertical centre on one side

top-50 end-0 translate-middle-y places a next arrow on the side of a slider.

Giving that you can see

20Corner tag on a pricing card

A badge at top-0 start-50 translate-middle sits on the top border.

Best value
Yearly
$181.46