gpt4 book ai didi

javascript - 将 div 的大小调整为小于其声明的大小?

转载 作者:技术小花猫 更新时间:2023-10-29 12:40:43 37 4
gpt4 key购买 nike

有没有办法将 div 的大小调整为小于声明的高度和宽度?

我正在制作一个应用程序,用户可以在其中调整 div 的大小并保存它。但是,当我稍后加载它并将其设置为用户上次设置的大小时,他们可以使 div 变大,但不能变小。

这是一个示例 div:

.cls {
border: solid 1px;
width: 100px;
height: 100px;
resize: both;
overflow: auto;
}​

http://jsfiddle.net/FNXnD/

This question有同样的问题,但使用 GWT,似乎没有好的解决方案。

最佳答案

如果您想使用 CSS3 UI 调整大小功能,您的浏览器将决定您是否可以使其小于或大于声明的宽度或高度。 http://www.w3.org/TR/css3-ui/#resize

The user agent may restrict the resizing range to something suitable, such as between the original formatted size of the element, and large enough to encompass all the element's contents.

例如,在 Firefox 中,您可以将其调整为小于您声明的宽度或高度。而在 Chrome 中你不能。

关于javascript - 将 div 的大小调整为小于其声明的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12985133/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com