The simplest code:

var marginleft = jQuery(this).find(".image").css("margin-left"); var paddingleft = jQuery(this).find(".image").css("padding-left"); 

The result is given with integers. The problem is that if the margin is set via em, then Chrome calculates it with decimal values, and Firefox rounds off the values. As a result, I can’t precisely position an element in chrome, there’s always a 1px brute force, since we’ll say the calculated margin-left is 23.9998, and jQuery only gives 23.

  • why not take clean js? He does not round off - Vasily Barbashev
  • He seems to be able to give the result in em, but I need px values. - Flector
  • no, it returns px even if em is specified. Because These are calculated fields using getComputedStyle(node) - Vasily Barbashev

0