This is a slimmed-down version of my post that returns a display element’s current (computed) css value as all possible units. This version takes a single argument and returns a single conversion (e.g., pass it to an element with style.width=10pt; with the unit argument set to “px” and get back the equivalent property as pixels).