Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make the horizontal scrollbar for a DIV always appear fixed on the bottom of the page?

Tags:

css

I have a website which contains a large (and wide) table. The table is placed inside jquery UI tabs.

It looks something like this: http://jsfiddle.net/Tq3Rg/

For the user this can be somewhat annoying since he has to go all the way to the bottom of the table and page to scroll right.

Is it possible to make the scrollbar always appear fixed on the bottom of the page?

like image 561
Andreas Larsson Avatar asked Jul 04 '12 14:07

Andreas Larsson


People also ask

How do I make my horizontal scroll bar always visible?

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.

How do I keep the scrollbar at the bottom in CSS?

use css position top keep it at the bottom {position : relative; bottom:0;} . Remove the css property once the user has scroll.

How do I stop scrollbar from moving?

The easy fix is to use width: 100% instead. Percentages don't include the width of the scrollbar, so will automatically fit. If you can't do that, or you're setting the width on another element, add overflow-x: hidden or overflow: hidden to the surrounding element to prevent the scrollbar.

How do I fix the horizontal scroll bar in HTML?

To hide the horizontal scrollbar and prevent horizontal scrolling, use overflow-x: hidden: HTML.


1 Answers

Set a fixed height (and don't use inline-styles):

Your altered Demo

the code:

.top{
   height:10%;
}
.center{
   overflow:scroll;
   height:80%;
}
.bottom{
   height:10%;
}

If you really want to have the scrollbars at the very bottom of your page, you could check this answer on how to achieve this without needing custom scrollbars and such stuff.

like image 177
Christoph Avatar answered Oct 02 '22 01:10

Christoph