Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visible overflow in one direction with scrolling in the other direction

Tags:

css

I need to have absolutely positioned element which scrolls with its parent. The absolutely positioned element may be wider than the scrollable container, in which case the content is currently being clipped. It appears that combining overflow-y: auto; and overflow-x: visible; does not work.

Here is a JSFiddle to illustrate the problem. Notice the popups cause horizontal scrolling.

And this is what it should look like here, only with scrolling.

Can this be accomplished through CSS?

like image 587
Wizard of Ogz Avatar asked Dec 14 '12 06:12

Wizard of Ogz


People also ask

What is scrolling overflow?

overflow: scroll Setting the value to scroll , the overflow is clipped and a scrollbar is added to scroll inside the box. Note that this will add a scrollbar both horizontally and vertically (even if you do not need it): You can use the overflow property when you want to have better control of the layout.

What causes horizontal overflow?

An overflow issue occurs when a horizontal scrollbar unintentionally appears on a web page, allowing the user to scroll horizontally. It can be caused by different factors. It could occur because of unexpectedly wide content or a fixed-width element that is wider than the viewport.

How do I make my vertical overflow scroll?

For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.

What is the difference between overflow scroll and overflow auto?

The difference For that, you need overflow: auto , which lets a browser automatically determine if a scroll bar is needed — or not. So in short: overflow: scroll : Always show a scroll bar. overflow: auto : Show a scroll bar when needed.


Video Answer


1 Answers

You have a hard coded width. The <div> will automatically take the full width of the page, so you want to do is restrict the maximum width that the div can contain so change the width: 400px to something like max-width: 90%

Here's a JSFiddle example: http://jsfiddle.net/c8DdL/3/

like image 60
ryanfelton Avatar answered Nov 12 '22 12:11

ryanfelton