我认为这可以满足您的要求:
http://jsfiddle.net/tprats108/7LBcr/3/
CSS:
#chatbar {
height: 100%; // This is pretty much the main difference (also removed top)
}
.first {
height: 30px;
}
#sidebar, #chathistory, textarea {
width:300px;
}
#sidebar {
position:fixed;
display:block;
right:0;
top:0;
bottom:0
}
.widget {
background: #eee;
margin: 10px 0
}
#chathistory {
overflow-y: auto;
bottom: 60px;
position: absolute;
}
textarea {
bottom:0;
right:0;
height:50px;
position:absolute;
}
html:(除了整理之外,我认为我没有更改它)
<div id="sidebar">
<div class="widget first">Variable content</div>
<div class="widget" id="chatbar">
<span class="username">John Doe</span>
<div id="chathistory">
<div class="msgs">This is a sample chat msg. Lorem Ipsum</div>
<div class="msgs">This is a sample chat msg. Dolor Sit</div>
<div class="msgs">This is a sample chat msg. Amet Confus</div>
<div class="msgs">This is a sample chat msg. Lorem Ipsum</div>
<div class="msgs">This is a sample chat msg. Dolor Sit</div>
<div class="msgs">This is a sample chat msg. Amet Confus</div>
<div class="msgs">This is a sample chat msg. Lorem Ipsum</div>
<div class="msgs">This is a sample chat msg. Dolor Sit</div>
<div class="msgs">This is a sample chat msg. Amet Confus</div>
<div class="msgs">This is a sample chat msg. Lorem Ipsum</div>
<div class="msgs">This is a sample chat msg. Dolor Sit</div>
<div class="msgs">This is a sample chat msg. Amet Confus</div>
<div class="msgs">This is a sample chat msg. Lorem Ipsum</div>
<div class="msgs">This is a sample chat msg. Dolor Sit</div>
<div class="msgs">This is a sample chat msg. Amet Confus</div>
<div class="msgs">This is a sample chat msg. Lorem Ipsum</div>
<div class="msgs">This is a sample chat msg. Dolor Sit</div>
<div class="msgs">This is a sample chat msg. Amet Confus</div>
</div>
<textarea rows="1" cols="30"></textarea>
</div>
</div>