mozilla

Revision 25275 of resize

  • Revision slug: CSS/resize
  • Revision title: resize
  • Revision id: 25275
  • Created:
  • Creator: grendel
  • Is current revision? No
  • Comment Migrated browser compat data to new table and added Chrome data plus other formatting fixes; 12 words added, 67 words removed

Revision Content

{{ CSSRef() }}

Summary

The resize CSS property lets you control the resizability of an element.

  • {{ Xref_cssinitial() }}: none
  • Applies to: block-level and replaced elements, table cells, and inline blocks
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

Syntax

resize: none | both | horizontal | vertical | inherit

Values

none
The element offers no user-controllable method for resizing the element.
both
The element displays a mechanism for allowing the user to resize the element, which may be resized both horizontally and vertically.
horizontal
The element displays a mechanism for allowing the user to resize the element, which may only be resized horizontally.
vertical
The element displays a mechanism for allowing the user to resize the element, which may only be resized vertically.
Note: resize does not apply to blocks for which the {{ cssxref("overflow") }} property is set to visible.

Examples

Disabling resizability of textareas

By default, {{ HTMLElement("textarea") }} elements are resizable in {{ gecko("2.0") }} (Firefox 4). You may override this behavior with the CSS shown below:

textarea.example {
  resize: none; /* disables resizability */
}

Using resize with arbitrary elements

You can use the resize property to make any element resizable. In the example below, a resizable {{ HTMLElement("div") }} box contains a resizable paragraph ({{ HTMLElement("p") }} element:

<div style="resize:both; overflow:scroll; width:300px; height:300px; border:1px solid black">
  <p style="resize:both; overflow:scroll; width:200px; height:200px; border:1px solid black">
    This paragraph is resizable, because the CSS resize property is set to 'both' on this
    element.
  </p>
</div>

arbitrary.png

 

{{ CSSLiveSample("resize.html") }}

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 4.0 (2.0) {{ CompatNo() }} {{ CompatNo() }} 3.0 (522)
Applies to  <textarea> block-level and replaced elements, table cells, and inline blocks (unless {{ cssxref("overflow") }} is visible)     <textarea>
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

Specification

  • {{ spec("http://www.w3.org/TR/2004/CR-css3-ui-20040511/#resize","CSS3-UI: resize", "CR") }}

See also

  • {{ HTMLElement("textarea") }}

{{ languages({"de":"de/CSS/resize"}) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h2>Summary</h2>
<p>The <code>resize</code> CSS property lets you control the resizability of an element.</p>
<ul> <li>{{ Xref_cssinitial() }}: none</li> <li>Applies to: block-level and replaced elements, table cells, and inline blocks</li> <li>{{ Xref_cssinherited() }}: no</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}: as specified</li>
</ul>
<h3>Syntax</h3>
<pre>resize: none | both | horizontal | vertical | inherit
</pre>
<h2>Values</h2>
<dl> <dt>none</dt> <dd>The element offers no user-controllable method for resizing the element.</dd> <dt>both</dt> <dd>The element displays a mechanism for allowing the user to resize the element, which may be resized both horizontally and vertically.</dd> <dt>horizontal</dt> <dd>The element displays a mechanism for allowing the user to resize the element, which may only be resized horizontally.</dd> <dt>vertical</dt> <dd>The element displays a mechanism for allowing the user to resize the element, which may only be resized vertically.</dd>
</dl>
<div class="note"><strong>Note:</strong> <code>resize</code> does not apply to blocks for which the {{ cssxref("overflow") }} property is set to <code>visible</code>.</div>
<dl> <h3>Examples</h3> <h4>Disabling resizability of textareas</h4> <p>By default, {{ HTMLElement("textarea") }} elements are resizable in {{ gecko("2.0") }} (Firefox 4). You may override this behavior with the CSS shown below:</p> <pre class="brush: css">textarea.example {
  resize: none; /* disables resizability */
}
</pre> <h4>Using resize with arbitrary elements</h4> <p>You can use the resize property to make any element resizable. In the example below, a resizable {{ HTMLElement("div") }} box contains a resizable paragraph ({{ HTMLElement("p") }} element:</p> <pre class="brush: html">&lt;div style="resize:both; overflow:scroll; width:300px; height:300px; border:1px solid black"&gt;
  &lt;p style="resize:both; overflow:scroll; width:200px; height:200px; border:1px solid black"&gt;
    This paragraph is resizable, because the CSS resize property is set to 'both' on this
    element.
  &lt;/p&gt;
&lt;/div&gt;
</pre> <p><img alt="arbitrary.png" class="internal default" src="/@api/deki/files/4966/=arbitrary.png"></p> <p> </p> <p>{{ CSSLiveSample("resize.html") }}</p> <h2 name="Browser_Compatibility">Browser compatibility</h2> <p>{{ CompatibilityTable() }}</p> <div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> <td>1.0</td> <td>4.0 (2.0)</td> <td>{{ CompatNo() }}</td> <td>{{ CompatNo() }}</td> <td>3.0 (522)</td> </tr> <tr> <td>Applies to</td> <td> <span class="Apple-style-span" style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal; ">&lt;textarea&gt;</span></td> <td>block-level and replaced elements, table cells, and inline blocks (unless {{ cssxref("overflow") }} is <code>visible</code>)</td> <td> </td> <td> </td> <td><code>&lt;textarea&gt;</code></td> </tr> </tbody> </table> </div> <div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody> </table> </div> <h2>Specification</h2> <ul> <li>{{ spec("http://www.w3.org/TR/2004/CR-css3-ui-20040511/#resize","CSS3-UI: resize", "CR") }}</li> </ul> <h3>See also</h3> <ul> <li>{{ HTMLElement("textarea") }}</li> </ul> <p>{{ languages({"de":"de/CSS/resize"}) }}</p></dl>
Revert to this revision