Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML textarea min-width ignored when width is set

Tags:

html

css

textarea

The min-width seems to be ignored, I cannot scale less than 200px;

Any workaround?

<textarea style='width:200px; max-width:400px; min-width:100px'>
    text
</textarea>
like image 843
selytch Avatar asked Apr 02 '26 02:04

selytch


1 Answers

That's how it's suppose to work! The min-width and max-width properties should be used together to define a range of value for the element to resize to given the user's conditions (eg. monitor size). Explicitly giving the same element a width simply defeats this purpose.

See http://reference.sitepoint.com/css/min-width for more information

If you want a resizable textarea that grows with the amount of content the user adds you can have a look at this jQuery plugin: http://james.padolsey.com/javascript/jquery-plugin-autoresize/

like image 172
Yi Jiang Avatar answered Apr 03 '26 18:04

Yi Jiang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!