You need to iterate over an object with images, adding css styles, .css () will not work because you need to take into account the height of each individual element.

var slickSlide = $('.rome-page-examples-slide img'); $.each(slickSlide, function(key){ var slickSlideHeight = key.height(); key.css('top', 75 -slickSlideHeight/2); }); 

    2 answers 2

    .css is fine

     $('.rome-page-examples-slide img').css('top', function(index,value){ var objHeight = $(this).height(); return 75 - objHeight/2; }) 
       $('.rome-page-examples-slide img').each(function(i, obj) { var objHeight = $(obj).height(); $(obj).css('top', 75 - objHeight/2); });