var newH = $(window).height() / 2; var newW = $(window).width() / 2; var newParams = { 'height':'height: ' + newH + 'px !important;', 'width':'width: ' + newW + 'px !important;' }; $('#foo').css({'cssText':newParams.height + newParams.width});
#foo { background-color:#faa; }
<div id='foo'>TEST</div>