2014-03-06 26 views
1

下面的代码来完成我想要的(JS Fiddle):引导3流体以及高度

HTML

<div class="well"> 
    <div> 
    <p>Really long text...</p> 
    </div> 
</div> 
<div class="input-group"> 
    <input type="text" autofocus="autofocus" class="form-control"> 
    <span class="input-group-btn"> 
     <button type="button" class="btn btn-default">Send</button> 
    </span> 
    </input> 
</div> 

CSS

div.well div { 
    height: 100px; 
    overflow-y: scroll; 
} 

但我想这样做不指定高度,以便井总是占用屏幕的剩余高度。有没有办法做到这一点没有JavaScript?

编辑:添加什么,我最终想要做的图像,来提供内容的问题,我试图解决:

Chat application mockup

回答

1

什么样呢? http://jsfiddle.net/jiantongc/uqw43/2/

div.well { 
    position: absolute; 
    top: 0px; 
    bottom:40px; 
    left:0; 
    right:0; 
    overflow-y: scroll; 
} 

.user-input{ 
    position: absolute; 
    bottom:5px; 
} 
+0

我添加了一个形象的问题,所以你可以看到我想要的反应。这在移动视图中会很好,但是当涉及到桌面视图时,我无法将它放在聊天室中人员列表的左侧。 – mhenry

+0

当然,你可以,只是使用相同的概念...虽然我不是绝对定位的大粉丝... http://jsfiddle.net/jiantongc/uqw43/4/,也看到我老小提琴http: //jsfiddle.net/jiantongc/7uVNN/ – jiantongc