简体   繁体   中英

Can element width/height be less than min-width/min-height?

I have defined min-width for div elements ( float:left ). I set their actual width from JavaScript based on window size using $('div.element').css('width','123')

This arrangement works well most of the time but breaks when the browser introduces a vertical scroll-bar, resizing the elements to less than min-width.

Can the elements be re-sized to less than min-width from JavaScript by changing just their width?

You should not be able to change an element's width to less than its specified min-width value. Here is a jsfiddle showing how this works, click on the divs to see their width after having it set in JavaScript: http://jsfiddle.net/jasper/sPen2/1/

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