开发者

HTML textarea min-width ignored when width is set

开发者 https://www.devze.com 2023-01-12 13:06 出处:网络
The min-width seems to be ignored, I cannot scale les开发者_开发技巧s than 200px; Any workaround?

The min-width seems to be ignored, I cannot scale les开发者_开发技巧s than 200px;

Any workaround?

<textarea style='width:200px; max-width:400px; min-width:100px'>
    text
</textarea>


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消