<!DOCTYPE html> <html> <head> <style type="text/css"> #a { background-color: green; margin-bottom: 40px; height: 20px; } #b { background-color: green; margin-top: 20px; } #b div { height: 20px; margin-top: 10px; } </style> </head> <body> <div id="a"> </div> <div id="b"> <div></div> </div> </body> </html>