[英]horizontal scroll with height fixed on 100%
这是我创建的http://jsfiddle.net/ZygnV/
<html>
<head>
<style type="text/css">
html, body{
margin: 0;
padding: 0;
height: 100%;
}
.main-content-wrapper{
height: 100%;
overflow-y: hidden;
white-space: nowrap;
}
.main-sidebar{
display: inline-block;
height: 100%;
width: 220px;
background-color: rgb(0,0,0);
}
.main-content{
display: inline-block;
height: 100%;
width: 10000px;
}
</style>
</head>
<body>
<div class="main-content-wrapper">
<nav class="main-sidebar">
</nav><section id="main-content" class="main-content">
</section>
</div>
</body>
问题是垂直滚动太小:我想没有它。
为什么是这个小虫子? 我该如何解决? 我本来想将overflow-y:hidden设置为隐藏的,但我认为这不是最好的解决方案:如果我要设置最小高度,然后显示滚动条,它将始终处于隐藏状态(除非我使用js脚本操作)
这可以帮助您
.main-content {
display: inline-block;
height: 100%;
position: absolute;
width: 10000px;
}
.main-sidebar {
background-color: #000000;
display: inline-block;
height: 100%;
position: absolute;
width: 220px;
}
添加overflow:hidden
到主div
.main-content-wrapper{
height: 100%;
white-space: nowrap;
overflow:hidden
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.