CKTIS / CSS
CSS property `right`
The `right` property sets the physical right inset of a positioned element: with `position:absolute` it is the distance from the containing block’s right edge, while with `position:relative` a positive value shifts the painted element left without moving its normal-flow slot.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
auto | <length-percentage>The right property sets the physical right inset of a positioned element: with position:absolute it is the distance from the containing block’s right edge, while with position:relative a positive value shifts the painted element left without moving its normal-flow slot.
In the example, right:10% places the absolute item at coordinate 230 in a 300-wide container, while right:20px moves the relative item from 100 to 80; its sibling remains at 100.
Grammar: auto | <length-percentage>.
With position:sticky, the inset is measured against the relevant scrollport edge. Percentages use the containing block’s width, negative values are allowed, and physical right does not switch sides with writing direction as inset-inline-end does; if left is also specified, direction controls the over-constrained resolution.
Examples
<!doctype html><meta charset="utf-8"><style>html,body{margin:0}.stage{position:relative;width:300px;height:80px}.abs{position:absolute;right:10%;top:0;width:40px;height:10px}.rel,.sibling{display:block;margin-left:100px;width:30px;height:10px}.rel{position:relative;right:20px}</style><div class="stage"><i id="abs" class="abs"></i><i id="rel" class="rel"></i><i id="sibling" class="sibling"></i></div><pre id="result"></pre><script>const x=e=>Math.round(e.getBoundingClientRect().left),a=x(abs),b=x(rel),c=x(sibling),ra=getComputedStyle(abs).right,rr=getComputedStyle(rel).right;if(a!==230||b!==80||c!==100||ra!=='30px'||rr!=='20px')throw new Error('right mismatch '+[a,b,c,ra,rr]);result.textContent='absolute='+a+'; relative='+b+'; sibling='+c+'; computed='+ra+'/'+rr;</script>Result
absolute=230; relative=80; sibling=100; computed=30px/20px
In the example, `right:10%` places the absolute item at coordinate 230 in a 300-wide container, while `right:20px` moves the relative item from 100 to 80; its sibling remains at 100.