Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

overflow (scroll) to work with negative `left` and `top` positioned elements

Tags:

html

css

What is the workaround to allow scrollable overflow with elements positioned negatively from left and top?

Like here in example (jsFiddle), only 3 of the red squares are visible and scroll is not toggled. Although there are 6 of the squares, 3 of them positioned negative of top.

like image 644
tomsseisums Avatar asked Feb 26 '12 10:02

tomsseisums


1 Answers

The only way I can think of is to wrap the squares in a div the same height as them and use JQuery's scrollTop() method: http://www.w3schools.com/jquery/css_scrolltop.asp but this will also force a horizontal scrollbar beneath the wrapper div... short answer: no CSS-only solution, and positioning them absolutely obviates the scroll for this solution - try floating left and clearing each row if you want to use this method.

like image 179
Dave Everitt Avatar answered Oct 17 '22 18:10

Dave Everitt