我确信这很容易,但我被困住了。
我在这里有一个简单的演示来说明。
容器宽度是最大宽度(流体)。
右列是设定宽度,但左栏是流动的,页脚底部是粘性的。
我只需要延长左列的高度(黄色),使其为100%,它会触及页脚
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css">
<style type="text/css">
/*--stickyFooter--*/
html, body {
height: 100%;
}
#wrap {
min-height: 100%;
max-width:1000px;
margin:0 auto;
border-left:20px solid white;
border-right:20px solid white;
}
#main {
overflow:auto;
padding-bottom: 150px;/* must be same height as the footer */
height:100%;
min-height:100%;
}
footer {
position: relative;
margin:-150px auto 0 auto;
height: 150px;
clear:both;
max-width:1000px;
background:red;
border-left:20px solid white;
border-right:20px solid white;
}
body:before {/*Opera Fix*/
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;/
}
/*--END-stickyFooter--*/
header{
height:100px;
background:#ddd;
}
#rightCol{
height:100px;
background:#eee;
width:200px;
float:left;
}
#leftCol{
margin-left:210px;
background:yellow;
height:auto;
height:100%;
}
</style>
</head>
<body>
<div id="wrap">
<header>
<h2>Header</h2>
</header>
<div id="main">
<div id="rightCol">
<h2>Right Col</h2>
</div><!-- #rightCol -->
<div id="leftCol">
<h2>Left Col</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div><!-- #leftCol -->
</div>
</div><!--wrap-->
<footer>
<div id="footer-container">
<h2>Footer</h2>
</div><!-- #footer-container -->
</footer>
</body>
</html>
答案 0 :(得分:0)
让我们试试这个:
#leftCol {
position: absolute;
width: 789px;
}