You should recalculate the element height:
$(function() {
$(window).resize(function() {
var width = $(this).width() - 200;
$("#gallery").css({
"width": width,
"height": width*(9/16)
});
}).resize();
});
Here's a proof-of-concept fiddle: http://jsfiddle.net/teddyrised/w555h/6/