| <!DOCTYPE html> |
| <style> |
| .positioned { |
| top: 0; |
| position: absolute; |
| width: 100px; |
| height: 100px; |
| background-color: green; |
| } |
| .normal { |
| max-width: 100%; |
| display: block; |
| height: auto; |
| background-color: blue; |
| } |
| </style> |
| <p> Change in margin should move a positioned object.</p> |
| <ul id="container"> |
| <li class="positioned"> |
| <div class="normal"> |
| </li> |
| </ul> |
| <script> |
| function test() { |
| document.querySelector('.positioned').style['margin-left'] = 'initial'; |
| document.body.offsetTop; |
| for (var i = 0; i < 101; ++i) { |
| document.querySelector('.positioned').style['margin-left'] = i + "%"; |
| } |
| } |
| window.onload = test; |
| </script> |
| |