[英]CSS two column layout with fluid height 100%
这是我的布局-我用了2页。 我需要同时达到全高(100%)和灵活的高度。 红色块为空,只有标题/字幕和完整的bg(封面)图像。
在右侧,第一页有少量文字,第二页有大量文字,这就是为什么我需要保持流畅的原因。
我尝试了更多的方法,但我无法使其工作..而且我不想使用js-仅使用纯css2。
有人能帮我吗? 谢谢。
如果您想更改.top和.bottom的高度,它将起作用。请记住,更改var heighs的值是(.bottom .top)height Java脚本(jquery)
<script type="text/javascript" src="http://www.designerbh.com/index_files/jquery-1.9.1.min.js"></script>
<script>
setInterval(function(){
var heights=$("body").height();
var heights=heights-100;
console.log(heights);
$(".red ,.gray").css({'height':heights});
},100);
</script>
HTML
<body style='margin:0px'>
<div class='top'>
</div>
<div class='red'>
</div>
<div class='gray'>
</div>
<div class='bottom'>
</div>
</body>
的CSS
<style>
.top{
float:left;
width:100%;
height:50px;
background:black;
color:white;
}
.red{
float:left;
width:50%;
height:100%;
background:red;
}
.gray{
float:left;
width:50%;
height:100%;
background:#ccc;
}
.bottom{
float:left;
width:100%;
height:50px;
background:black;
color:white;
}
</style>
我只建议您使用Bootstrap,而您不必担心-查看其网格getbootstrap.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.