Jquery CSS method: better writing

http://stackoverflow.com/questions/24830605/jquery-css-method-better-writing

by Aaron Kahlhamer

HTML

<div>Work</div>

JavaScript

var theirStyles = {
    'position' : 'absolute',
    'top' : '0',
    'left' : '0',
    'bottom' : '0',
    'margin' : '0',
    'font-size' : '30px'
};

var myStyles = {
    'width' : '300px',
    'margin-left' : '-300px'
};

var combinedStyles = $.extend({}, myStyles, theirStyles);


$('div').css(combinedStyles);


//$( 'div' ).css(theirStyles).css({'width' : '300px', 'margin-left': '300px'});