resize CSS propertyThe resize CSS property sets whether an element is resizable, and if so, in which directions.
resize: both;resize: horizontal;resize: vertical;resize: none;<section class="default-example" id="default-example">
<div id="example-element">Try resizing this element.</div>
</section>#example-element {
background: linear-gradient(135deg, cyan 0%, cyan 94%, white 95%);
border: 3px solid #c5c5c5;
overflow: auto;
width: 250px;
height: 250px;
font-weight: bold;
color: black;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}resize does not apply to the following:
overflow property is set to visible or clip/* Keyword values */
resize: none;
resize: both;
resize: horizontal;
resize: vertical;
resize: block;
resize: inline;
/* Global values */
resize: inherit;
resize: initial;
resize: revert;
resize: revert-layer;
resize: unset;This property is specified as one of the following keyword values:
noneThe element offers no user-controllable method for resizing it.
bothThe element displays a mechanism for allowing the user to resize it, which may be resized both horizontally and vertically.
horizontalThe element displays a mechanism for allowing the user to resize it in the horizontal direction.
verticalThe element displays a mechanism for allowing the user to resize it in the vertical direction.
blockThe element displays a mechanism for allowing the user to resize it in the block direction (either horizontally or vertically, depending on the writing-mode and direction value).
inlineThe element displays a mechanism for allowing the user to resize it in the inline direction (either horizontally or vertically, depending on the writing-mode and direction value).
| Initial value | none |
|---|---|
| Applies to | elements with overflow other than visible, and optionally replaced elements representing images or videos, and iframes |
| Inherited | no |
| Computed value | as specified |
| Animation type | discrete |
resize =
none |
both |
horizontal |
vertical |
block |
inline
In many browsers, <textarea> elements are resizable by default. You may override this behavior with the resize property.
<textarea>Type some text here.</textarea>textarea {
resize: none; /* Disables resizability */
}You can use the resize property to make any element resizable. In the example below, a resizable <div> contains a resizable paragraph (<p> element).
<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>.resizable {
resize: both;
overflow: scroll;
border: 1px solid black;
}
div {
height: 300px;
width: 300px;
}
p {
height: 200px;
width: 200px;
}