使用 calc 你可以得到宽度。
http://jsfiddle.net/3n1gm4/vne79/
HTML:
<div id="list"> The Menu </div>
<div id="container">
<div id="content">
<p> ... </p>
</div>
</div>
<nav>
<a href="" class="one">Link 1</a>
<a href="" class="two">Link 2</a>
<a href="" class="three">Link 3</a>
</nav>
CSS:
身体{边距:0;填充:0;}
#list {
position: fixed;
width: 300px;
height: 100%;
background-color: #262626;
color: #f00;
}
#container {
margin-left: 300px;
padding: 10px;
width: calc( 100% - 300px - 20px ); /* 100% - width of nav - padding */
height: 100%;
}
nav {
display: block;
position: fixed;
margin-left: 300px;
width: calc( 100% - 300px );
bottom: 0;
}
nav a {
display: block;
height: 35px;
width: calc( 100% / 3 ); /* could use 33.33333% as well */
float: left;
}
.one { background: #5ff; }
.two { background: #f5f; }
.three { background: #ff5; }