tags:

views:

885

answers:

2

Hello,

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.

Thank you for your time.

A: 

Have you tried overflow-y:auto? It is not exactly what you want, as the scrollbar will appear only when needed.

kgiannakakis
+3  A: 

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>
Eoin Campbell
This works in IE8 and Chrome as well +1
Jose Basilio
Also tested in IE7 and FireFox, and just <div style="overflow-y:scrol">Hello</div> works.
Staale
this is the style sheet i am using:#main_container { width:100%; background-color:#eeeeee; overflow-y: scroll; height:100%; position:absolute;}
Alec Smart
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Alec Smart
oh its working now... thanks.. i bychance placed a style tag saying overflow:auto in the div, which overwrote my external css...
Alec Smart