css - how to add scroll to div that have no fixed height -


i have div don't want give fixed height.

i want div have scroll in case content larger window,

i add div:

overflow: auto; overflow-x: hidden; 

but still don't see scroll if content bigger the window.

any thought on same appreciated.

you use javascript determine height of window , after set max-height css property @fags suggested.

<script> $(function() {   var $window = $(window);   var setmaxheight = function() {     $('#div_id').css('max-height', $window.height());   }   $window.on('resize', setmaxheight);   setmaxheight(); }); </script> 

Comments