HTML CSS examples for CSS Property:resize
The resize CSS property sets whether an element is resizable by the user or not.
The following table summarizes the resize Property.
Item | Value |
---|---|
Default value: | none |
Applies to: | Elements with overflow other than visible |
Inherited: | No |
Animatable: | No. |
The syntax of the property is as follows:
resize: none | both | horizontal | vertical | initial | inherit
The following table describes the values of this property.
Value | Description |
---|---|
none | user cannot resize the element. This is default value. |
both | user cam adjust both the height and the width of the element. |
horizontal | allow the user to adjust only the width of the element. |
vertical | allow the user to adjust only the height of the element. |
initial | Sets this property to its default value. |
inherit | take the value of its parent element resize property. |
The example below shows the resize property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS resize property</title> <style type="text/css"> textarea {<!--from w w w . ja va 2s . c om--> resize: none; } div { resize: both; overflow: auto; width: 300px; height: 100px; border: 1px solid #000000; } </style> </head> <body> <h2>Non-resizable textarea</h2> <textarea> This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. </textarea> <h2>Resizable div</h2> <div> You can resize this div by dragging the bottom right corner. </div> <p><strong>Note:</strong>The resize property is only supported by the Firefox 4+, Chrome and Safari.</p> </body> </html>