我知道这个 CSS 问题在互联网上随处可见。但是我很难让紫色和绿色的 div 填充它们的剩余空间,因此它们与黄色 twitter 提要的高度相同:
HTML
<div id="main">
<div id="primary" class="home">
<div id="content" role="main">
<div id="main-content" class="container_12">
<div id="info" class="grid_4">
<div id="networking">
<h2>RSViP - Business Networking</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In rhoncus lobortis orci, sed vestibulum leo dapibus et. Fusce in dolor velit, sit amet vehicula est. Integer elit sapien.</p> <a href="">Apply for Business Networking</a>
<a href="">Free Trial</a>
</div>
<div id="card">
<h2>RSViP - Card</h2>
</div>
</div>
<div id="twitter" class="grid_4">
<h2>News / Twitter Feed</h2>
<ul>
<li>
<p>Details of our next Business Network Social & 5th Birthday have been finalised- Invitations going out tomorrow to members <a href="http://www.twitter.com/HartsNottingham" target="_blank">@HartsNottingham</a>
</p>
<p id="date">3rd Apr 04:57 PM</p>
</li>
<li>
<p>Details of our next Business Network Social & 5th Birthday have been finalised- Invitations going out tomorrow to members <a href="http://www.twitter.com/HartsNottingham" target="_blank">@HartsNottingham</a>
</p>
<p id="date">3rd Apr 04:08 PM</p>
</li>
<li>
<p>Details of our next Business Network Social & 5th Birthday have been finalised- Invitations going out tomorrow to members <a href="http://www.twitter.com/HartsNottingham" target="_blank">@HartsNottingham</a>
</p>
<p id="date">3rd Apr 03:28 PM</p>
</li>
<li>
<p>Details of our next Business Network Social & 5th Birthday have been finalised- Invitations going out tomorrow to members <a href="http://www.twitter.com/HartsNottingham" target="_blank">@HartsNottingham</a>
</p>
<p id="date">3rd Apr 03:28 PM</p>
</li>
</ul>
</div>
<div id="col3" class="grid_4">
<h2>RSViP Free Subscription</h2>
</div>
</div>
</div>
</div>
</div>
CSS
.home #main-content {
margin-top: 23px;
margin-bottom: 23px;
height: 100%;
}
/*Col1 - Info*/
.home #info {
width: 270px;
padding-right: 30px;
background: url('images/divider.png') repeat-y top right;
height: 100%;
background: purple;
}
/*Col2 - Twitter*/
.home #twitter {
padding-left: 10px;
width: 290px;
background: yellow;
}
.home #twitter ul {
list-style: none;
margin: 0; padding: 0;
}
/* Col3 */
.home #col3 {
background: green;
}
/* 960.gs */
谢谢你,彼得