如何滚动Div

时间:2014-04-30 05:39:57

标签: javascript jquery html css

我想要我的div class =" W"可滚动但我没能做到。
需要帮助提前致谢。

<div style = "visibility:hidden" id = "Box">
    <div style = "background-color: green" "border: solid" "width: 50px" id = "H" onclick  = "ok()" ><center><center><button class = "C" onclick = cross() >X</button></div>
    <div class= "F">
        <div class= "W" style = 'border:solid 100px' 'width:100px' ></div>
        <input type = "text" id = "I" size = "30px"  onchange = "go()" />
    </div>
</div>

1 个答案:

答案 0 :(得分:1)

<强> DEMO

你犯了一些非常基本的错误:

1)您将错误的内联样式分开:

style = "background-color: green" "border: solid" "width: 50px"

它们应该用分号分隔:

style = "background-color: green; border: solid; width: 50px"


2)您也忘了正确打开和关闭中心标签。


3)父div上存在可见性隐藏样式,根本无法呈现HTML!


制作Div Scrollable 制作&#34; w&#34; div scrollable你必须限制它的高度然后使用溢出滚动属性,如下所示:

style="border:solid 100px; width:100px; height: 500px; overflow-y: auto;"