HTML CSS examples for CSS Layout:Relative Position
Side by side divs with negative relative position
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #container {<!--from w ww . j av a 2s. c o m--> width:251px; height:251px; position:absolute; top:51px; left:100px; border:2px solid Chartreuse; } #foo { position:absolute; top:6px; left:6px; height:51px; width:51px; border:2px solid yellow; } #bar { position:absolute; top:4px; left:4px; height:51px; width:51px; border:2px solid blue; } </style> </head> <body> <div id="container"> <div id="foo"></div> <div id="bar"></div> </div> </body> </html>