HTML CSS examples for CSS Layout:Relative Position
suppress the position: relative when using translate
<html lang="en"> <head> <style> #one {<!--from ww w .j a va 2s .co m--> background-color:Chartreuse; width:100px; height:100px; position:relative; } #two { background-color:yellow; width:51px; height:51px; -webkit-transform:translateY(26px) translateX(26px); transform:translateY(26px) translateX(26px); } .displacement { -webkit-transform:translateY(-26px) translateX(-26px); transform:translateY(-26px) translateX(-26px); position:absolute; top:0; right:0; bottom:0; left:0; width:201%; height:201%; } #three { background-color:blue; height:26px; width:26px; position:absolute; top:0; left:0; } </style> </head> <body translate="no"> <div id="one"> <div id="two"> <div class="displacement"> <div id="three"></div> </div> </div> </div> </body> </html>