将div调整为小于其声明的大小? [英] Resize a div to smaller than its declared size?

查看:152
本文介绍了将div调整为小于其声明的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is there a way to resize a div to smaller than the declared height and width?

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

I'm making an application where the user can resize a div and save it. However, when I load it later and set it to the size the user set to last time, they can make the div bigger, but not smaller.

这是一个示例div:

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

http://jsfiddle.net/FNXnD/

这个问题有相同的问题,但使用GWT和

This question has the same issue but uses GWT and doesn't seem to have a good solution.

推荐答案

您要求解决问题的解决方法,或者想知道如何解决问题。最小。我给你一个简单的解决方法,可能需要一点工作;注意这是一个解决方法,因此可能包含毛刺。

You requested a workaround for your problem, or was wondering how-to at least. I made you a simple workaround that might require a little work; note it is a workaround, and might therefore contain glitches.

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

.cls:hover {
    width: 1px;
    height: 1px;
}


更新的小提琴: http://jsfiddle.net/FNXnD/1/


  • 注意 Chrome和Safari可能会在未来版本中更改CSS3调整大小功能。

  • Note Chrome, and Safari might change the CSS3 resize feature in future versions.

这篇关于将div调整为小于其声明的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆