Craftx398
Craftx398

Reputation: 339

Add scroll bar in div inside a table

index.html

<td>
<div id="wrapper">
words go her alot of them
</div>
</td>

style.css

  #wrapper {
            height: 100%;
            width: 200px;
            overflow: auto;
          }

I am currently unable to get the scroll bar to appear, this is what I get:

enter image description here

Upvotes: 1

Views: 2093

Answers (5)

BlackComb
BlackComb

Reputation: 63

You would need to add a height to the td tag;

Example:

height="250px" or change your height in your #wrapper.

Upvotes: 1

Ousmane D.
Ousmane D.

Reputation: 56433

You could use the overflow property:

#wrapper {
   height: 100%;
   width: 200px;
   overflow: scroll;
}

The overflow property specifies what happens if content overflows an element's box.

This property specifies whether to clip content or to add scrollbars when an element's content is too big to fit in a specified area.

Note: The overflow property only works for block elements with a specified height.

Further reading - W3Schools
Further reading - MDN

Upvotes: 3

Craftx398
Craftx398

Reputation: 339

overflow-y: scroll

i used this and it fixed the problem

Upvotes: 0

Peter Cadwell
Peter Cadwell

Reputation: 109

Try setting overflow to scroll:

#wrapper {
  overflow: scroll;
}

Upvotes: 1

Prav
Prav

Reputation: 2894

Try setting

overflow: scroll;

Should do the trick

Upvotes: 1

Related Questions