Tuesday, December 9, 2014

The CSS3 resize property


One of the lesser-appreciated CSS3 properties, resize does exactly what it says: it allows a user to resize almost any  element it is applied to. The property itself is something of a misnomer: it does not make content larger or smaller, and is perhaps more akin to a user-modifiable clip property.
resize can take four values, in addition to inherit:
noneThe element cannot be resized. This is the default for the majority of elements in most browser’s UA stylesheets.
horizontalThe element may be resized by the user, but only horizontally.
verticalThe element is restricted to vertical resizing only
bothThe element may be resized both horizontally and vertically
resize does not apply to block elements in which overflow has been set to visible, nor is it supported on .
On a practical level, browsers that currently support resize apply it to textarea  by default.While this is a good idea – a user should be able to resize a textarea box to get more room for what they are typing – unrestricted resizing can spoil some page designs. In most cases, it is better to rewrite the  rule to restrict resize of the textarea to one direction only:
textarea { resize: vertical; }

No comments:

Post a Comment