#nearest-positioned-ancestor { border: black solid medium; height: 150px; padding: 25px; position: relative; width: 50px; } div > div { background-color: blue; height: 50px; left: 50%; position: absolute; top: 0px; width: 50px; }

Test passes if the blue square is in the top right corner of the black box.