Div高度100%格式化问题

And*_*son 2 html css3

我试图让侧边栏填充标题和脚之间的高度.正如你所看到的那样,它会落​​后于页脚.我希望它停在页脚的顶部.任何帮助都会很棒!

演示:http://www.jsfiddle.net/pEbhK/

HTML:

<div class="header">
        <h2>Development Area</h2>
</div>
<div class="sidebar">
        <h2>Current Projects</h2>
    <ul>
        <li>iCalendar</li>
        <li>MyBand - Student Center</li>
    </ul>
        <h2>Future Projects</h2>
    <ul>
        <li>Mobile Application</li>
        <li>RSS Feed</li>
    </ul>
</div>
<div class="clear"></div>
<div class="footer">&copy; 2013</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

html, body, h1, h2 {
    margin:0px;
    padding:0px;
}
.clear {
    clear:both;
}
.header {
    display:inline-block;
    width:100%;
    background:#ABBFF2;
    height:100px;
    border-bottom: 5px solid #7F9DEB;
    text-align:center;
}
.header h2 {
    padding-top:38px;
}
.sidebar {
    position: fixed;
    height:100%;
    width:250px;
    background:#ABBFF2;
    border-right:5px solid #7F9DEB;
    float:left;
}
.sidebar h2 {
    text-align:center;
}
.footer {
    position:fixed;
    display:inline-block;
    bottom:0px;
    width:100%;
    height:30px;
    border-top:5px solid #7f9deb;
    text-align:center;
}
Run Code Online (Sandbox Code Playgroud)

Roy*_*ish 5

尝试height:calc(100% - 140px).sidebar

.sidebar {
    position: fixed;
    height:calc(100% - 140px);
    width:250px;
    background:#ABBFF2;
    border-right:5px solid #7F9DEB;
    float:left;
}
Run Code Online (Sandbox Code Playgroud)

更新了jsFiddle文件