Helllo伙计们! 我想让我的左侧菜单高度为100%。
右侧会有一个内容区域,右侧也会有一个页脚。
我希望左边的浅蓝色菜单到达页面的底部0。
检查这个JSFiddle http://jsfiddle.net/mYw72/
或者这段代码!
<div id="container">
<div id="top">
<div id="logo"></div>
<div id="user-tools">
<a href="#">Help</a>
<span> | </span>
<a href="#">Contact us</a>
</div>
</div>
<div id="sidebar">
<ul>
<li><a href="#">Company</a></li>
<li><a href="">Administrator</a></li>
<li><a href="#">App</a></li>
<li><a href="#">Configuration</a></li>
<li><a href="#">Statistics</a></li>
<li><a href="#">Monitor</a></li>
<li><a href="#">Preference</a></li>
</ul>
</div>
<div id="rightSide">
<div id="content">
Content.
</div>
<div id="bottom1">
<div id="line-bottom"></div>
<div id="text-bottom">Copyright 2012 <span>ME</span>, Inc. All Rights Reserved</div>
</div>
</div>
</div>
css是这样的
html {
padding:0px;
margin:0px;
}
body {
background-color: #ECEDEF;
font-family: Verdana, Tahoma, Sans-Serif;
color:#564b47;
padding:0px;
margin:0px;
}
#top {
background-image: url('../img/top.png');
background-repeat: repeat-x;
width: 100%;
height: 96px;
}
#rightSide{
overflow: hidden;
}
#sidebar{
position: relative;
background:lightblue;
border-right:1.7px solid #FFFFFF;
min-height: 100%;
line-height: 100%;
float: left;
height: 100%;
margin-top: -5px;
}
#sidebar ul li {
list-style-type: square;
list-style-position: inside;
width:209px;
height:100%;
margin-top:15px;
}
#sidebar ul li a{
list-style-position: inside;
display: block;
color:#3C3C3C;
text-decoration:none;
font-size:13px;
font-weight:bold;
padding:10px 20px 10px 40px;
}
#sidebar ul li a:hover {
color:#7da536;
width:209px;
border-right: 1.7px solid #ECEDEF;
background: #ECEDEF;
}
#sidebar ul li a:active{
background: #ECEDEF;
border-top: 1.7px solid #D8D9DB;
border-bottom: 1.7px solid #FFF;
border-right: 1.7px solid #FFF;
width:149px;
}
#content{
margin-left: 10px;
}
#bottom {
position: absolute;
bottom: 0;
background-color: #ECEDEF;
width: 100%;
padding: 53px 0 0 0;
}
#bottom1 {
position: absolute;
bottom: 0;
/*background-color: #ECEDEF;*/
background-color: greenyellow;
/* width: 85.3%;*/
width: 100%;
padding: 53px 0 0 0;
/* margin-left: 211px;*/
}
答案 0 :(得分:5)
html, body, #container { height: 100% }
答案 1 :(得分:1)
您可以将左侧栏的高度设置为100%,之后所有内容的高度也设置为100%。
示例css:
html, body, #container{height:100%}
#sidebar{height:100%;}