Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide "Horizontal" Scrollbar but still able to scroll

Tags:

css

I need some help with hiding my horizontal scrollbar and still able to scroll. I have used webkit but does not work in IE and firefox. I have seen alot of help with vertical scrollbar, but does not work with horizontal. Any help?

Update: I have created a JSFiddle to show my problem. I want to hide the horizontal scrollbar and still able to scroll without using

 ::-webkit-scrollbar { 
      display: none; 
   }

http://jsfiddle.net/o1xoh9w8/1/

like image 991
Acer Buxton Avatar asked Apr 04 '16 14:04

Acer Buxton


People also ask

How do I make my scrollbar invisible but still scroll?

Hide Scrollbars But Keep Functionality IE and Edge supports the -ms-overflow-style: property, and Firefox supports the scrollbar-width property, which allows us to hide the scrollbar, but keep functionality.

How do I hide the scroll bar horizontally?

Under Display options for this workbook, clear or select the Show horizontal scroll bar check box and Show vertical scroll bar check box to hide or display the scroll bars.

How do I hide horizontal scrollbar while scrolling CSS?

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

How do I scroll down without a bar?

Click Start > Settings. Under Windows Settings, scroll down, and then click Ease of Access > Display. Scroll down, and then set Automatically hide scroll bars in Windows to Off.


1 Answers

I used a fixed height approach.

Note: this approach can help only in specific cases.

#container1{
    height: 50px;

    /* Just for presentation. Can be removed */
    border: 1px solid red;

    /* Hides content outside this container */
    overflow: hidden;
}

#container2{
    /* Height is significantly greater than the height of container#1 to hide
       any possible scroll */
    height: 100px;
    overflow: auto;
    white-space: nowrap;
}
<div id="container1">
  <div id="container2">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam hendrerit, ante laoreet mattis blandit, arcu nisi blandit felis, et molestie justo lacus et sem. Nunc tempor tellus sit amet eleifend tristique. Integer eget condimentum lectus, nec viverra risus. Nullam leo lectus, placerat vitae porta eget, auctor et nisi. Suspendisse feugiat in lacus accumsan tincidunt. Fusce pulvinar accumsan sem sit amet finibus. Curabitur volutpat mi vitae eros mattis congue. In ut sem eu tellus egestas lobortis vitae eu felis. Maecenas sodales, nisl eu bibendum vulputate, neque leo finibus odio, sit amet bibendum libero dolor sed diam. In molestie magna vitae dui vulputate, eu consequat dui ullamcorper. In hac habitasse platea dictumst. Vestibulum pulvinar, mi quis mollis pulvinar, metus justo aliquet arcu, vel venenatis ipsum dolor at sapien. Sed ac odio bibendum, feugiat nibh at, viverra mi. Morbi sem nisi, ultricies non nulla pretium, gravida malesuada neque.
  </div>
</div>

(My case is horizontal scrollable buttons container for mobile screens - the buttons are stuck to the above block (+ margin) and have fixed height)

enter image description here

like image 143
Nikita Avatar answered Sep 22 '22 13:09

Nikita