Div垂直滚动条显示 [英] Div vertical scrollbar show

查看:157
本文介绍了Div垂直滚动条显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何可以永久显示一个div(灰色,如果没有滚动)类似于我们的常规酒吧的垂直条。基本上我想把整个网站放在一个div(如gmail / facebook),所以如果页面不够长,整个页面因为缺乏垂直滚动条而改变。



我需要解决这个问题。我试过overflow-y:scroll。

解决方案

您在测试什么浏览器?



您设置了什么DOCType?



您如何声明您的CSS?



您确定在 overflow-y:scroll ?之前/之后没有错过; p>

我刚刚测试了下面的IE7和Firefox和它工作正常

 <! - 滚动条存在但禁用 - > 
< div style =width:200px; height:100px; overflow-y:scroll;>
test
< / div>
<! - 滚动条当前和启用 - >
< div style =width:200px; height:100px; overflow-y:scroll;>
test< br />
test< br />
test< br />
test< br />
test< br />
test< br />
test< br />
test< br />
test< br />
test< br />
< / div>


I am wondering how its possible to permanently show the vertical bar of a div (greyed out if there is no scrolling) similar to our regular bars. Basically I am trying to place an entire website in a div (like gmail/facebook), so if the page is not long enough the whole page shifts because of the lack of the vertical scroll bar.

I need a solution to this problem. I tried overflow-y:scroll. But it doesn't seem to work at all.

解决方案

What browser are you testing in?

What DOCType have you set?

How exactly are you declaring your CSS?

Are you sure you haven't missed a ; before/after the overflow-y: scroll?

I've just tested the following in IE7 and Firefox and it works fine

<!-- Scroll bar present but disabled -->
<div style="width: 200px; height: 100px; overflow-y: scroll;">
    test
    </div>
<!-- Scroll bar present and enabled -->        
    <div style="width: 200px; height: 100px; overflow-y: scroll;">
    test<br />
    test<br />
    test<br />
    test<br />
    test<br />
    test<br />
    test<br />
    test<br />
    test<br />
    test<br />
    </div>

这篇关于Div垂直滚动条显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆