使用此示例:
HTML:
CSS:
body {
font: normal 16px/1.5em helvetica,arial,sans-serif
}
p {
text-align:center;
}
#container {
width:960px;
margin:0px auto;
}
#header {
text-align:center;
background: #777;
color:#fff;
height:50px;
padding:5px;
}
#content {
float:right;
width:610px;
text-align:center;
background:#ccc;
padding:150px 5px;
}
#sidebar {
float:left;
width:330px;
text-align:center;
height:300px;
background:#eee;
padding:15px 5px;
overflow:auto;
}
#footer {
clear:both;
text-align:center;
background: #555;
color:#fff;
height:50px;
padding:5px;
}
最佳答案
请尝试以下方法:
$('#sidebar').height($(window).height() - 50)
原文链接:https://www.f2er.com/jquery/428620.html