<!DOCTYPE html> <html> <head> <style type="text/css"> #separator { height: 20px; background-color: green; } #float { width: 50px; margin-right: auto; padding: 40px 0; background-color: green; } #child { height: 20px; background-color: lightgreen; } #spacer { height: 20px; } </style> </head> <body> <div id="separator"></div> <div id="spacer"></div> <div id="float"> <div id="child"></div> </div> </body> </html>