<!DOCTYPE html> | |
<style> | |
#container { | |
text-align: center; | |
width: 100px; | |
} | |
#relpos { | |
position: relative; | |
background: red; | |
} | |
#abspos { | |
position: absolute; | |
left: 0; | |
top: 0; | |
width: 50px; | |
height: 50px; | |
background: green; | |
} | |
</style> | |
<body> | |
<div id="container"> | |
<span id="relpos">x | |
<span id="abspos"></span> | |
</span> | |
</div> | |
</body> |