简体   繁体   中英

How to resize DIV to less than its initial width & height?

I want to give the user the ability to resize a DIV to less than its declared width and height. How to ?

Code here: http://jsfiddle.net/hW4nn/

HTML

<div class="divClass"></div>

CSS

.divClass {
    resize: both;
    overflow: auto;
    width: 200px;
    height: 200px;
    border: 1px dotted #000;
}

As far as I know, the browser will not let you resize any smaller than the initial size. My workaround would be to set the initial CSS to a minimal width and height (whatever you think that should be, eg 50px or so); then use javascript to change the CSS of the div onload so that it is properly sized.

See also HTML5 resize only on makes items larger than original size, not smaller .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM