Reputation: 257
I have a div which I don't want to give fixed height.
I want this div to have a scroll in case the content is larger then the window,
I add this to my div:
overflow: auto;
overflow-x: hidden;
but I still don't see the scroll if the content is bigger the the window.
Any thought on the same is appreciated.
Upvotes: 0
Views: 2991
Reputation: 8981
try this
max-height:set from javascript
and overflow-x:scroll;
For Example
Upvotes: 0
Reputation: 737
You could use javascript to determine the height of the window and after that set the max-height css property like @Fags suggested.
<script>
$(function() {
var $window = $(window);
var setMaxHeight = function() {
$('#div_id').css('max-height', $window.height());
}
$window.on('resize', setMaxHeight);
setMaxHeight();
});
</script>
Upvotes: 1