div可调整大小像文本区域 [英] div resizable like text-area

查看:118
本文介绍了div可调整大小像文本区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,浏览器允许通过拖动文本区域的大小来调整文本区域的大小。我想知道这个规则是否可以应用于其他元素(例如div)。我知道这个效果可以使用jQuery draggable 或jQuery-ui resizable 函数实现,但我想做它与纯html / css如果是可能避免依赖那个库。是他们的任何CSS规则,我可以应用到一个div,使它的行为,以这种方式?

Browsers allow text-areas to be re-sized by dragging their corner by default. I was wondering if this rule could be applied to other elements (a div for instance). I know this effect could be achieved using the jQuery draggable or the jQuery-ui resizable function, but I would like to do it with plain html / css if it is possible to avoid relying on that library. Are their any CSS rules that I could apply to a div to make it behave in this way?

如果你有任何其他解决方案,我想听到它。 p>

If you have any other solution I would like to hear it.

推荐答案

使用css3 resize 属性。

Use the css3 resize property.

div {
    resize: both;
}

还有一个 resize:horizo​​ntal resize:vertical

跨浏览器 http://caniuse.com/#feat=css-resize

这篇关于div可调整大小像文本区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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