CKTIS / CSS
CSS property `position-try-order`
`position-try-order` decides whether options retain declared `normal` order or are stably sorted by available space, for example with `most-height`.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
normal | most-width | most-height | most-block-size | most-inline-sizeposition-try-order decides whether options retain declared normal order or are stably sorted by available space, for example with most-height.
The example gives both labels an option on the opposite side of the anchor: normal chooses the first fitting area above it, while most-height first chooses the larger area below it.
Grammar: normal | most-width | most-height | most-block-size | most-inline-size.
most-width and most-height compare physical dimensions; most-block-size and most-inline-size compare logical dimensions in the containing block’s writing mode. Sorting is stable, so ties preserve list order; the property changes priority, not option contents.
Examples
<!doctype html><meta charset="utf-8"><style>html,body{margin:0}.stage{position:absolute;top:0;width:200px;height:220px}.anchor{position:absolute;left:80px;top:80px;width:40px;height:20px;anchor-name:--a}.tip{position:absolute;position-anchor:--a;position-area:block-start;width:60px;height:20px;position-try-fallbacks:flip-block}#normalStage{left:0}#sizedStage{left:300px}#sized{position-try-order:most-height}</style><div id="normalStage" class="stage"><i class="anchor"></i><b id="normal" class="tip"></b></div><div id="sizedStage" class="stage"><i class="anchor"></i><b id="sized" class="tip"></b></div><pre id="result"></pre><script>const relative=(box,stage)=>{const a=box.getBoundingClientRect(),b=stage.getBoundingClientRect();return[Math.round(a.left-b.left),Math.round(a.top-b.top)]},a=relative(normal,normalStage),b=relative(sized,sizedStage),x=getComputedStyle(normal).positionTryOrder,y=getComputedStyle(sized).positionTryOrder;if(a.join(',')!=='70,60'||b.join(',')!=='70,100'||x!=='normal'||y!=='most-height')throw new Error('order mismatch '+[a,b,x,y]);result.textContent='normal='+a.join(',')+'; most-height='+b.join(',')+'; computed='+x+'/'+y;</script>Result
normal=70,60; most-height=70,100; computed=normal/most-height
The example gives both labels an option on the opposite side of the anchor: `normal` chooses the first fitting area above it, while `most-height` first chooses the larger area below it.