The CSS for pos
is complex because we support both stack
and relative
containers.
/* For stack containers */:where([class*='stack']) > { .pos-top { place-self: start center; } .pos-topleft { place-self: start start; } .pos-topright { place-self: start end; } .pos-topfull { place-self: start stretch; } .pos-bottomleft { place-self: end start; } .pos-bottom { place-self: end center; } .pos-bottomright { place-self: end end; } .pos-bottomfull { place-self: end stretch; } .pos-left { place-self: center start; } .pos-leftfull { place-self: stretch start; } .pos-right { place-self: center end; } .pos-rightfull { place-self: stretch end; } .pos-center { place-self: center center; } .pos-overlay { display: grid; > * { grid-column: 1 / span 1; grid-row: 1 / span 1; } }}
/* For relative containers */:where([class*='relative']) > & { .pos-top { position: absolute; inset-block-start: 0; inset-inline: 0; width: fit-content; margin-inline: auto; }
.pos-topleft { position: absolute; inset-block-start: 0; inset-inline-start: 0; }
.pos-topright { position: absolute; inset-block-start: 0; inset-inline-end: 0; }
.pos-topfull { position: absolute; inset-block-start: 0; inset-inline: 0; }
.pos-bottom { position: absolute; inset-block-end: 0; inset-inline: 0; width: fit-content; margin-inline: auto; }
.pos-bottomleft { position: absolute; inset-block-end: 0; inset-inline-start: 0; }
.pos-bottomright { position: absolute; inset-block-end: 0; inset-inline-end: 0; }
.pos-bottomfull { position: absolute; inset-block-end: 0; inset-inline: 0; }
.pos-left { position: absolute; inset-block: 0; inset-inline-start: 0; height: fit-content; margin-block: auto; }
.pos-leftfull { position: absolute; inset-block: 0; inset-inline-start: 0; }
.pos-right { position: absolute; inset-block: 0; inset-inline-end: 0; height: fit-content; margin-block: auto; }
.pos-rightfull { position: absolute; inset-block: 0; inset-inline-end: 0; }
.pos-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pos-overlay { position: absolute; inset: 0; }}