Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

div resizable like text-area

Tags:

html

css

textarea

Browsers allow text-areas to be re-sized by dragging their corner by default. I was wondering if this rule could be applied to other elements (a div for instance). I know this effect could be achieved using the jQuery draggable or the jQuery-ui resizable function, but I would like to do it with plain html / css if it is possible to avoid relying on that library. Are their any CSS rules that I could apply to a div to make it behave in this way?

If you have any other solution I would like to hear it.

like image 711
codelove Avatar asked Jun 22 '12 20:06

codelove


People also ask

How do I make a div fit to content?

Answer: Use the CSS display Property You can simply use the CSS display property with the value inline-block to make a <div> not larger than its contents (i.e. only expand to as wide as its contents).


1 Answers

Use the css3 resize property.

div {     resize: both; } 

There is also a resize: horizontal and resize: vertical.


Not currently cross browser http://caniuse.com/#feat=css-resize

like image 156
sachleen Avatar answered Sep 20 '22 01:09

sachleen