Here is a test case/live example.总结的问题:CSS:为什么设置margin-top只能在Webkit中工作?
WebKit中这仅适用于:
Y.one('#container').setStyle('margin-top', 100);
这适用于所有的浏览器:
Y.one('#container').setStyle('margin', 100);
为什么设置的margin-top仅工作在WebKit的?
编辑:修复程序显示在下面的答案之一。你需要在这里有marginTop,然后才能工作。所以,编辑的问题是,为什么在这种情况下你需要marginTop而不是margin-top?
我也可以确认IE。 – Robert 2010-08-12 23:26:19
这几乎是答案。我还想要一些W3C参考或者指向这个marginTop vs margin-top的东西。任何人? :) – Jaanus 2010-08-12 23:27:57
http://www.w3schools.com/css/pr_margin-top.asp 向下滚动,它告诉你访问与JavaScript为“object.style.marginTop =”10px“ – Robert 2010-08-12 23:29:57