首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >伸展div,但不是整个页面

伸展div,但不是整个页面
EN

Stack Overflow用户
提问于 2012-08-20 15:53:35
回答 2查看 105关注 0票数 1

我有一个动态高度的框架。

在其中,我有3个部分,其中一个是内容部分。

我想要将内容的边缘固定到与框架的恒定距离。

这是a fiddle to reproduce the issue。我在小提琴中使用jquery-ui-dialog只是因为它在重现问题时更容易使用。解决方案不能包含特定于jquery-ui-dialog的代码。它可以使用jquery和jquery-ui。

如果存在CSS解决方案,则更可取。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-08-20 16:26:08

您需要应用"alsoResize“选项...然后,您的内容将与容器同时增长。

引用:

代码语言:javascript
复制
Resize these elements synchronous when resizing.

Code examples

Initialize a resizable with the alsoResize option specified.
$( ".selector" ).resizable({ alsoResize: ".other" });
Get or set the alsoResize option, after init.
//getter
var alsoResize = $( ".selector" ).resizable( "option", "alsoResize" );
//setter
$( ".selector" ).resizable( "option", "alsoResize", ".other" );

来源:jQuery UI - Resizable option-alsoResize

票数 1
EN

Stack Overflow用户

发布于 2012-08-20 16:04:03

定位元素更容易解决您所描述的问题。例如,您可以使用position:absoulte。然后使用toprightbottomleft属性,您可以将元素定位在需要的位置。下面是一个css示例:

代码语言:javascript
复制
#content {
    border: 1px solid blue;
    bottom: 34px;
    top: 34px;
    left:10px;
    right:10px;
    position: absolute;
}
#footer {
    border: 1px solid green;
    bottom: 10px;
    left:10px;
    right:10px;
    position: absolute;
}

演示: http://jsfiddle.net/BV5Z6/4/

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12034012

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档