On Wednesday, 11 May 2011 14:02:39 UTC-3, Joel Dart wrote: > > Example test case: http://jsfiddle.net/RVpPx/1/ > > > > I noticed that if you horizontally center a div in a space using “margin: 0 > auto;” that getComputedStyle returns 0px… or at least FF4, Chrome 11, and > Opera 11.10 do. IE9 gives me the actual margin applied. MDN on > getComputedStyle<https://developer.mozilla.org/en/DOM:window.getComputedStyle>says > it returns the used > values <https://developer.mozilla.org/en/CSS/used_value> so I would think > that IE9 is giving me the correct value here, but why is it that all the > other browsers are giving me the exact same wrong value? >
Sorry, but I didn't see anything wrong with FF4 and Chrome11 as to “margin: 0 auto;” applied to a horizontally centered DIV. Are you trying to figure out the dimensions of that particular DIV? If so, you might get the element's dimensions by using el.scrollWidth / scrollHeight / offsetWidth / offsetHeight. But take care with some quirk behaviour described at: <http://www.quirksmode.org/dom/w3c_cssom.html>. Another useful link: <http://msdn.microsoft.com/en-us/library/ms530302(v=VS.85).aspx> -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
