How to add multiple CSS elements to a div using jQuery?

You're thinking correctly. Using the css(map) method is the way to go.

$(".cIconSmall").css({
    float: "left", 
    width: "59px", 
    background: "transparent url('http://download.com/47.jpg') no-repeat scroll -132px -1px" 
});

http://api.jquery.com/css/

A map of property-value pairs to set.


Might be nicer as a css class, though... then you can just write $(".cIconSmall").addClass("icon47"); but there's a time for everything...


$(".yourClass").css({
    float: "left",
    width: "59px",
    background: "transparent url('http://download.com/47.jpg') no-repeat scroll -132px -1px"
});

Tags:

Css

Jquery