Make <div> resizeable

Chris picture Chris · Dec 24, 2008 · Viewed 54.5k times · Source

Is there a way to make a <div> container resizeable with drag'n'drop? So that the user can change the size of it using drag'n'drop?

Any help would really be appreciated!

Answer

Georg Sch&#246;lly picture Georg Schölly · Dec 24, 2008

The best method would be to use CSS3. It supported by at least Webkit and Gecko.

According to the w3c spec:

div.my_class {
    resize:both;
    overflow:auto; /* something other than visible */
}

Webkit and Firefox do not interpret the specs the same way. In Webkit the size is limited to the width and height set. There's another question: How can I use CSS to make an element resizable to a dimension smaller than the initial one? concerning this.