INTERACTION / 096

Resizable region

大きさを変えられる領域
角のつまみをドラッグすると、領域の幅や高さが変わります。

実際のHTML・CSSで描かれた見本です。

ラボで詳しく試す ↗

ひとつ試すなら

どこが変わるかを観察して、似た表現と見比べてみよう。

こんなときに

レイアウトの確認や、入力欄の大きさ調整。

仕組みと使い方

リサイズ操作の提供方法はブラウザや端末によって異なります。

resizeドラッグ大きさサイズ変更
実装コードを見る
<style>
.sample{width:100%;height:100%;min-height:190px;display:grid;place-items:center;position:relative;overflow:hidden;box-sizing:border-box;font-family:Arial,'Hiragino Kaku Gothic ProN',Meiryo,sans-serif;color:#20211d;background:#f1f0e9;padding:22px}.sample *{box-sizing:border-box}.sample button,.sample input,.sample summary{font:inherit}.sample button,.sample summary,.sample label{touch-action:manipulation}.sample :focus-visible{outline:3px solid #6050bf;outline-offset:5px}.sample small{font-size:10px;line-height:1.5}.sample .editable{margin:0}.sample svg{max-width:100%;height:auto}
.sample .resizable{width:190px;height:108px;max-width:100%;max-height:155px;min-width:115px;min-height:80px;resize:both;overflow:auto;background:#bba9e2;border:2px solid #222;padding:18px;font-size:13px;font-weight:700}.sample small{display:block;margin-top:12px}
</style>
<div class="sample">
<div class="resizable" tabindex="0">角をドラッグ<small>RESIZE ME ↘</small></div>
</div>