--- title: resize slug: Web/CSS/resize tags: - CSS - CSS プロパティ - CSS 基本ユーザーインターフェイス - Reference translation_of: Web/CSS/resize ---
CSS の resize プロパティは、要素の寸法を変更できるかどうか、もしそうなら、どの方向に変更できるかを設定します。
このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 https://github.com/mdn/interactive-examples をクローンしてプルリクエストを送信してください。
/* キーワード値 */ resize: none; resize: both; resize: horizontal; resize: vertical; resize: block; resize: inline; /* グローバル値 */ resize: inherit; resize: initial; resize: unset;
resize プロパティは以下の挙げた単一のキーワード値で指定します。
nonebothhorizontalverticalblock {{experimental_inline}}inline {{experimental_inline}}メモ: resize は以下の場合は適用されません。
visible に設定されたブロック要素多くのブラウザーでは、 {{HTMLElement("textarea")}} 要素は既定で寸法が変更できます。 resize プロパティでこの動作を上書きすることができます。
textarea {
resize: none; /* Disables resizability */
}
<textarea>Type some text here.</textarea>
{{EmbedLiveSample("Disabling_resizability_of_textareas","200","100")}}
resize プロパティを使用して、任意の要素の寸法を変更可能にすることができます。以下の例では、寸法が変更可能な {{HTMLElement("div")}} の中に、寸法が変更可能な段落 ({{HTMLElement("p")}} 要素) を配置しています。
.resizable {
resize: both;
overflow: scroll;
border: 1px solid black;
}
div {
height: 300px;
width: 300px;
}
p {
height: 200px;
width: 200px;
}
<div class="resizable">
<p class="resizable">
This paragraph is resizable in all directions, because
the CSS `resize` property is set to `both` on this element.
</p>
</div>
{{EmbedLiveSample("Using_resize_with_arbitrary_elements","450","450")}}
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('CSS Logical Properties', '#resize', 'resize')}} | {{Spec2('CSS Logical Properties')}} | block と inline の値を追加 |
| {{SpecName('CSS3 Basic UI', '#resize', 'resize')}} | {{Spec2('CSS3 Basic UI')}} | 初回定義 |
{{cssinfo}}
{{Compat("css.properties.resize")}}