Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox getComputedStyle returning none computed value

I'm calling getComputedStyle on an element that defines left, right and bottom.

In Chrome this returns 'auto' as the value for top but in Firefox this returns the pixel value, however if you look at the inspector in Firefox the top value doesn't show up in the computed pane.

Is there any way to workaround this? Here is a fiddle showing the issue http://jsfiddle.net/DEfusion/9NaGD/

like image 328
DEfusion Avatar asked Mar 20 '26 17:03

DEfusion


1 Answers

Via: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle

In Firefox, properties with the value auto return the used value, not the value auto. So if you apply top:auto; and bottom:0; on an element with height:30px and its containing block is height:100px;, upon requesting the computed style for top, Firefox will return top:70px, as 100px-30px=70px.

like image 167
Prisoner Avatar answered Mar 23 '26 05:03

Prisoner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!