Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `resize`

The `resize` property lets the user resize a scroll container: `both` uses both physical axes, `horizontal` or `vertical` uses one, while `block` or `inline` follows the writing mode’s logical axis.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

none | both | horizontal | vertical | block | inline

The resize property lets the user resize a scroll container: both uses both physical axes, horizontal or vertical uses one, while block or inline follows the writing mode’s logical axis.

The example drags the real handle of an element with resize:both; Chromium changes its border box from 100x60 to 130x80, so the result comes from user interaction rather than a scripted style change.

Grammar: none | both | horizontal | vertical | block | inline.

With overflow:visible or overflow:clip, browsers normally expose no handle. The min-width, max-width, min-height, and max-height constraints still bound the result, none disables resizing, and handle appearance and accessibility are UA-defined.

Examples

<!doctype html><meta charset="utf-8"><style>html,body{margin:0}#box{box-sizing:border-box;width:100px;height:60px;min-width:80px;max-width:180px;min-height:40px;max-height:140px;overflow:auto;resize:both;border:2px solid}</style><div id="box">drag the corner</div><pre id="result"></pre><script>const start=box.getBoundingClientRect();document.addEventListener('mouseup',()=>requestAnimationFrame(()=>{const end=box.getBoundingClientRect(),a=[Math.round(start.width),Math.round(start.height)],b=[Math.round(end.width),Math.round(end.height)],r=getComputedStyle(box).resize;if(a.join('x')!=='100x60'||b.join('x')!=='130x80'||r!=='both')throw new Error('resize mismatch '+[a,b,r]);result.textContent='before='+a.join('x')+'; after='+b.join('x')+'; computed='+r}),{once:true});</script>

Result

before=100x60; after=130x80; computed=both

The example drags the real handle of an element with `resize:both`; Chromium changes its border box from `100x60` to `130x80`, so the result comes from user interaction rather than a scripted style change.

Sources