jQuery calculate padding-top as integer in px
The only solution i have found is ($(this).innerHeight() - $(this).height()) / 2

But / 2 is not right option, because user can have padding-top:0px and padding-bottom:20px.

Is there a way to make more accurate padding values?

I was thinking about css('padding-top') and then parse it, by taking only int part, but value can be in "em" for example and not in "px"

Then make switch statement for each value type? For em one, for px another?

It's all a bit complicated and takes more space in code...
jQuery calculate padding-top as integer in px
===

The only solution i have found is ($(this).innerHeight() - $(this).height()) / 2

But / 2 is not right option, because user can have padding-top:0px and padding-bottom:20px.

Is there a way to make more accurate padding values?

I was thinking about css('padding-top') and then parse it, by taking only int part, but value can be in "em" for example and not in "px"

Then make switch statement for each value type? For em one, for px another?

It's all a bit complicated and takes more space in code...