margin collapse with nested elements padding
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title></title> <style type='text/css'> div { margin: 20px; padding: 20px; background: #ddd; } p { margin: 0; padding: 20px; background: #ccc; } </style> </head> <body> <div> <p> this is a test. </p> </div> </body> </html>