垂直滚动条不工作或显示

时间:2016-05-04 07:04:26

标签: html css

我已经创建了这个html文件,其中使用ajax请求加载数据但是有一个尴尬的问题。它没有在任何浏览器中显示我的垂直滚动。

html

<div id="register1">
  <h2><center>Live Conversation</center></h2>
  <div id="showall">
    //data is loaded here using ajax request
  </div>
  <div id="white">
    <center>
      <textarea rows="5" cols="97" id="writebody"></textarea>
    </center>
    <br> // $msg is already set in my file
    <input type="button" name="enterbody" value="send" id="enterbody<?php echo $msg; ?>">
  </div>
</div>

CSS

#register1 {
    background: #f0f0f0;
    color: black;
    margin-left: auto;
    margin-right: auto;
    width: 800px;
    margin-top: 100px
}

#white {
    background: white;
    height: auto
}

可能是什么问题。

2 个答案:

答案 0 :(得分:2)

在结果容器#showall

上设置高度
#showall {
  height: 400px;
  overflow: auto;
}

答案 1 :(得分:0)

滚动属性使用内容高度和宽度以及溢出属性

如果您的内容高度和宽度小于屏幕高度和宽度,那么滚动将不会出现,如果内容超出容器高度和宽度滚动

检查以下内容

窗口滚动 here

容器滚动 http://fiddly.org/4b43b

相关问题