Div类浏览器高度

时间:2014-02-02 16:46:14

标签: html css magento

我们正在寻找一个解决方案,为我们的商店提供一个div浏览器高度。我们有店铺bit.ly/1bR9WPO,在这个商店你看到左栏有菜单(class = .leftside)。目前这个div的高度为1800px。唯一的问题是当你向下滚动时左侧比右侧部分长得多,如果你去一个超过1800px的页面,它将保持这个高度。我们希望它始终是浏览器的高度。

希望有人可以提供帮助。

2 个答案:

答案 0 :(得分:1)

body{
height:1800px;
}
.wrapper{
height:100%;
}
.leftside{
height:100%;
}
.page{
height:98%;//taking in to account your margins throught the page
}

答案 1 :(得分:0)

我认为这应该可以解决问题:
对于主包装器,添加position:absolute

.wrapper {
width: 1200px;
position: absolute;
}


左侧栏还添加了position:absolutetop:0以及height:100%

.leftside{
position: absolute;
width: 230px;
top: 0;
height: 100%;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.8);


对于页面div添加position:relativeleft:250px(230px的leftside widh + 20px的保证金)

.page{position: relative;
margin-top: 40px;
left: 250px;
float: left;
width: 762px;
text-align: left;
padding: 0px 20px;
background: rgb(255, 255, 255);}
相关问题