When centering an element with auto
, I'm finding different computed results between Firefox and Chrome.
div1 {width:100px; height: 100px; margin: 0 auto;}
When I check (with JavaScript) the computed style with either getComputedStyle
or currentStyle
, Chrome gives an actual number, in pixels, of how large the margin-left or margin-right is. Firefox, however, just posts as 0
, even though the element is centered. How can I get the same posted results using JavaScript from Firefox that I get from Chrome?
added: I do not need to change the value, I need to calculate the value in pixels, so that I can dynamically place other objects that my have 'position:fixed' on the page