mozilla

Revision 25277 of resize

  • Revision slug: CSS/resize
  • Revision title: resize
  • Revision id: 25277
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment +ja, little fix; 13 words added, 2 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", "fr": "fr/CSS/resize", "ja":"ja/CSS/resize" }) }}

Revision Source

<div>{{ CSSRef() }}</div> <h2 id="Summary">Summary</h2>
<p>The <code>resize</code> CSS property lets you control the resizability of an element.</p>
<ul class="cssprop"> <li><dfn>{{ Xref_cssinitial() }}:</dfn> none</li> <li><dfn>Applies to:</dfn> block-level and replaced elements, table cells, and inline blocks</li> <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li> <li><dfn>Media:</dfn> {{ Xref_cssvisual() }}</li> <li><dfn>{{ Xref_csscomputed() }}:</dfn> as specified</li>
</ul> <h2 id="Syntax">Syntax</h2>
<pre>resize: none | both | horizontal | vertical | inherit</pre> <h2 id="Values">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> <h2 id="Examples">Examples</h2> <h3 id="Disabling_resizability_of_textareas">Disabling resizability of textareas</h3>
<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> <h3 id="Using_resize_with_arbitrary_elements">Using resize with arbitrary elements</h3>
<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>{{ CSSLiveSample("resize.html") }}</p> <h2 id="Browser_Compatibility" 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> &lt;textarea&gt;</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 id="Specification">Specification</h2>
<ul> <li>{{ spec("http://www.w3.org/TR/2004/CR-css3-ui-20040511/#resize","CSS3-UI: resize", "CR") }}</li>
</ul> <h2 id="See_also">See also</h2>
<ul> <li>{{ HTMLElement("textarea") }}</li>
</ul> <div class="noinclude">{{ languages({
"de":"de/CSS/resize",
"fr": "fr/CSS/resize",
"ja":"ja/CSS/resize"
}) }}</div>
Revert to this revision