Add vertical Scrollbar to DIV in CSS

Last Reply 2 months ago By dharmendr

Posted 2 months ago

i wanted to add vertical scrollbar to div.
i have used overflow-y:scroll but the vertical scrollbar not coming.
what will be the issue behind that?

https://ibb.co/bVuFcf

http://alpha.dubaiexporters.com/Default.aspx

 

You are viewing reply posted by: dharmendr 2 months ago.
Posted 2 months ago

Hi chetan,

Change the css with below css.

#currency_converter .form_table
{
    display: block;
    float: left;
    width: 100%;
    border-left: solid 1px #cccccc;
    border-right: solid 1px #cccccc;
    border-bottom: solid 1px #cccccc;
    padding-bottom: 10px;
    background-color: #ffffff;
    max-height: 200px;
    overflow-y: scroll;
    overflow-x: hidden;
}

Check the below example.

<style type="text/css">
    #currency_converter
    {
        display: block;
        float: left;
        width: 100%;
        border-left: solid 1px #cccccc;
        border-right: solid 1px #cccccc;
        border-bottom: solid 1px #cccccc;
        padding-bottom: 10px;
        background-color: #ffffff;
        max-height: 300px;
        overflow-y: scroll;
        overflow-x: hidden;
    }
</style>
<div id="currency_converter">
    test<br />test<br />
    test<br />test<br />
    test<br />test<br />
    test<br />test<br />
    test<br />test<br />
    test<br />test<br />
    test<br />test<br />
    test<br />test<br />
    test<br />test<br />
    test<br />test<br />
</div>

Demo