0

I have a div with propertie overflow auto. How to make the content of this div horizontally aligned with and without the scrollbar displayed. The scrollbar is messing with the div width. I hope you understand.

Jacob
  • 3,580
  • 22
  • 82
  • 146

2 Answers2

1
overflow-x: scroll;
overflow-y: hidden;

source: Div with horizontal scrolling only

Community
  • 1
  • 1
Ricain
  • 638
  • 1
  • 4
  • 17
  • Something like this: http://stackoverflow.com/questions/8079187/how-to-calculate-the-width-of-the-scroll-bar – Jacob Jan 03 '13 at 15:05
  • you mean the width change in function of the content size? all div are like that by default else it is not html and css anymore, you need javascript – Ricain Jan 03 '13 at 16:44
0

Try using overflow-y: overlay instead.

.your-content{
   overflow-y: overlay;
}

NOTE::: overflow-y: overlay has been deprecated.

But this will make the scrollbar appear as an overlay without affecting the width of div or element.

Vivek Kumar
  • 2,625
  • 2
  • 25
  • 33