Thursday, September 5, 2013

When DOM marginLeft property is not working in Mobile tablets such as iPad and Nexus 7...

I had this problem and I was unable to get it work until several hours of debugging:

Javascript:
document.getElementById("myDiv").style.marginLeft = "100px";


HTML:
<table><tr><td align=center><div id="myDiv"> . . . </div></td></tr></table>


Guess what? It was due to the very unexpected "align=center" that prevents the div beneath from moving anywhere.

Weird problem. Weird cause.

No comments:

Post a Comment