Let\'s say the rule is as follows:
.largeField {
width: 65%;
}
Is there a way to get \'65%\' back somehow, and not the pixel value?
This is most definitely possible!
You must first hide() the parent element. This will prevent JavaScript from calculating pixels for the child element.
$('.parent').hide();
var width = $('.child').width();
$('.parent').show();
alert(width);
See my example.
Now... I wonder if I'm first to discover this hack:)
Update:
element.clone().appendTo('body').wrap('').css('width');
It will leave behind a hidden element before the
tag, which you may want to .remove()
.
See an example of one-liner.
I'm open to better ideas!