> I ran into a bit of an odd problem this morning: $.css returns
> values in whatever units they were set with in the stylesheet
> (Safari and Firefox both return values in px regardless of how
> they were defined).
> ...
> As a workaround, I'm inserting an element ... Then measuring it
> Is there a better way of getting pixel values fox css properties
> in Opera?
I have run into the problem with IE and css properties like padding-left or
border-right-width.
Your trick of measuring an element's width only works if there is no padding
on the element. Even then it doesn't work if a parent element is currently
hidden, rendering the measured element hidden as well. So, as far as I know
there is no jQuery core solution to this issue.
Long ago, I played with mods to .css() to get reliable pixel measurements
for all those properties, but it got complicated and seemed like a
performance nightmare. A simple call like .css("border-left-width") could be
very slow, and often you'd be making several calls to get all four borders.
Brandon later built the dimensions plugin and its approach of getting
multiple properties at once seems like the right way. It's probably best to
extend dimensions.js if this is widely needed functionality.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/