Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding a scrollbar in a div

Tags:

javascript

css

Is there a way using css to hide a scrollbar while still keeping its functionality? Even make it transparent or the same color of the background will be fine. Do I have to do this in JavaScript?

like image 863
CamelCamelCamel Avatar asked Feb 10 '11 21:02

CamelCamelCamel


People also ask

How can I hide scrollbar in iframe but still scroll?

1. Set the overflow of the parent div as hidden. 2. Set the overflow of the child div to auto and the width 200% (or anything more than 100%, or more than the width of the parent - so that the scrollbar gets hidden).

How do I make a div not scrollable?

On top of this for browser compatibility on the parent element you will need to apply text-align: center; which will apply the needed centering of the element. As for preventing scrolling on the div, all you need to apply on the footer is overflow: hidden; and that should do the trick.

How do I hide horizontal scrollbar but still scroll?

The second fiddle only scrolls horizontally, you can hold shift and then use mouse scroll to go left and right. I have also tested this in chrome and it works fine for me.

How do I hide the scroll bar on the right side?

Select " Display " on left and scroll down to " automatically hide scroll bars in Windows " . Now Enable it.


2 Answers

.className {
  overflow: auto;
  overflow-y: hidden;
}

The user will have to scroll using the mouse wheel I believe

Compatible with IE too...

like image 67
Myles Gray Avatar answered Sep 26 '22 02:09

Myles Gray


<div style="width: 500px; height: 500px; overflow: hidden;"></div>

Source: http://www.w3schools.com/css/pr_pos_overflow.asp

like image 26
scragz Avatar answered Sep 25 '22 02:09

scragz