Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Containing div to fit the inside content or viewport Reply To: [Solved] Containing div to fit the inside content or viewport

#186105
imag
Participant

If anyone is still willing I have made a reduced test case on codepen.

Test 1 gets a scroll(good) when the content is bigger then the viewport
but the wrapper is 100% of the viewport when the content is smaller(bad, no clickability under that div and the button must stay under that div regarding z-index)
Test 2 is vice versa.
I need a mix of those examples – for the wrapper to get a scroll if the viewport is smaller and fit the inside content if viewport is bigger.

Am I stupid or what – it seem to be a simple task

Test 1
#wrapper height:100%;
http://codepen.io/anon/pen/esqxL

Test 2
#wrapper height:auto;
http://codepen.io/anon/pen/yovkJ