$('#h').width() // from jQuery dimensions (core)
or
$('#h').css('width');
.width()
returns the calculated width. .css('width')
just returns whatever you've written into the style. So in general, it's a better idea to stick with .width()
unless you really want to know the actuall value.
If you need the width of an element in more "detail", check out the .innerWidth()
and .outerWidth()
methods from jQuery dimensions. Those calculate the width with padding
, borders
, padding
etc.
Ref.: .width(), .css(), .outerWidth(), .innerWidth()