Replaced JavaScript resizing with CSS rules to make it more robust