Log in

View Full Version : Overflow: hidden .... ah, really???



suction cup
01-05-2011, 03:37 PM
Hello everyone,

A real quick one this:

How is it possible to have a <div> with:

overflow: hidden; PLUS position: absolute;?

Currently, positioning it absolutely brings the scrollbar back, which is unwanted.

Please help.

Many Thanks.

jscheuer1
01-05-2011, 04:14 PM
An element with position absolute has an intrinsic width and height of 0, unless set otherwise. So depending upon what you put in it and how, there could be scrollbars. Or perhaps apparently nothing if its overflow is hidden.

If you set its width and height to 'auto', it should take on the dimensions of its content. But if there's a nested element inside it, that element might have scrollbars. Or if it's contained in a positioned element, perhaps not even a positioned one, that element might have scrollbars.

These things tend to be interdependent. And there could be slightly different takes on it depending upon the browser.

If you want more help:

Please post a link to a page on your site that contains the problematic code so we can check it out.