Reputation: 817
How can I add a horizontal scroll bar to a table that is inside a div? Is there CSS solution for this?
Upvotes: 6
Views: 40423
Reputation: 771
If you only want a horizontal scrollbar use overflow-x:auto; then set the width.
div
{
width: 300px;
overflow-x:auto;
overflow-y:hidden;
}
Upvotes: 7
Reputation: 2119
To add the scrollbar use overflow:
div {
width: 100px;
overflow: auto;
}
You have to add width to the table too:
table {
width: 300px;
}
Upvotes: 5
Reputation: 1612
Try it:
div {
display: block;
height: 200px;
overflow: scroll;
}
Upvotes: 4
Reputation: 5013
You will not be able to add a scrollbar to a table, but you can add it to a DIV containing your table.
For example:
<div style="width: 400px; height: 200px; overflow: scroll;">
<table>...</table>
</div>
Upvotes: 14