You can calculate the height of the contents using javascript and add a class to your div to override the height in the CSS.
in jQuery, outerHeight gives you the height of the element including the margins.
So you can do something like this:
var height = $('.content').outerHeight();
if(height>290) {
$('.content').addClass("bigger");
}
where .bigger class would have the override style.
See pen: codepen.io/alkshendra/pen/PZpvMO