user3148422
user3148422

Reputation: 73

How to scroll a Div

I want my div class = "W" scrollable but i failed to do it.
Need Help Thanks in advance.

<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>

Upvotes: 0

Views: 59

Answers (1)

Imran Bughio
Imran Bughio

Reputation: 4941

DEMO

You made few very basic mistakes:

1) You are separating inline styles wrong:

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

They should be separated by semicolon like this:

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


2) You also forgot to open and close the center tag properly.


3) There was visibility hidden style on parent div which wasn't rendering the HTML at all!.


Making Div Scrollable To make the "w" div scrollable you must restrict its height then use overflow scroll property like this:

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

Upvotes: 1

Related Questions