0

我对关于容器的 div 有疑问。它的高度是 100%,因为我希望 div 占据标题 div 之后的整个宽度和高度。问题是现在我不滚动显示全文。

我们还希望能够为平板电脑和智能手机滚动显示文本。

谢谢你的帮助。

<div class='header'>
   <div class='header-container'>

</div>
</div>
<div class='container-wrapper'>
   <div class='container-about'>
       <div class='about-text'>
            text comes here.....
            ........
       </div>
   </div>
</div>

链接:http ://ttest11234.librax.net/index.html

CSS:

* {
margin: 0 auto;
padding: 0;
  }

html, body {
height: 100%;
overflow: hidden;
  }

body {
font-size: 12px;
line-height: 1.5;
background: #000;
font-weight: 400;
}

.header {
top: 0px;
left: 0px;
width: 100%;
height: 100px;
position: fixed;
background: gray;
opacity: 0.8;
}

.header-container {
width: auto;
height: 100px;
margin: 0 10% 0 10%;
text-align: center;
}

.container-wrapper {
width: 100%;
height: 100%;
}

  .container-about {
    margin: 100px auto;
padding-bottom: 2%;
width: 100%;
height: 100%;
background: #FFF;
position: relative;
}

.container-about h3 {
padding: 0 10% 5% 10%;
font-family: 'Verdana', sans-serif;
font-size: 12px;
    line-height: 150%;
font-weight: 400;
}
4

3 回答 3

2

添加和的divoverflow: scroll property _container-about classcontainer-wrapper class

.container-about {
    background: none repeat scroll 0 0 #FFFFFF;
    height: 100%;
    margin: 100px auto;
    overflow: scroll;
    padding-bottom: 2%;
    position: relative;
    width: 100%;
}
于 2013-10-16T09:10:07.527 回答
1
  1. 您不应该为 .contain-about 使用固定的上边距,因为您将在移动设备上使用它们,因为这将占用比台式机更多的空间。相反,您可以使用 % 或 em。
  2. 将 overflow-x 设置为 auto 或滚动 .about-text 以获取滚动条。
于 2013-10-16T09:16:29.860 回答
1

解决方案只是添加overflow: auto.container-wrapper. 这为您提供了所需的滚动条。

但现在你的问题是 div 太高了(它是 100% 身体高度 + 100 像素)。给它一个100px顶部填充并绝对定位标题。

于 2013-10-16T09:09:25.173 回答