I have a table with lots of rows, which results in a bootstrap "table-responsive" having the scroll bar off the bottom of the screen. To see the data that overflows to the sides you have to scroll to the bottom, move the scroll bar, then scroll back up again.
Have a look at this fiddle, http://jsfiddle.net/Lq4uk/1/
Here is the HTML code,
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<th>#</th>
<th>Header 1</th>
... (bunch of headers)
</thead>
<tbody>
<tr>
<th>1</th>
<th>Some long text to make this overflow</th>
... (bunch of cells)
</tr>
... (lots more rows)
</tbody>
</table>
How can I make the horizontal scroll bar always visible?
Or, to look at it differently, how can I use the maximum amount of space available on the screen for the vertical size of the table?
To show the scrollbars always on the webpage, use overflow: scroll Property. It will add both horizontal and vertical scrollbars to the webpage. To add only horizontal scrollbar use overflow-x: scroll property and for vertical scrollbar use overflow-y: scroll property.
An alternative approach is to set the width of the html element to 100vw. On many if not most browsers, this negates the effect of scrollbars on the width. Save this answer. Show activity on this post.
Making all the div element in inline using display: inline-block; property. Adding the scroll bar to all the div element using overflow-x: auto; property. white-space: nowrap; property is used make all div in a single line.
In your CSS add these lines -
.table-responsive {
height: 100vh;
overflow: scroll;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With