0

Why is the top/bottom margin of the inside div outside of the parent, but the left/right not?

<body style="background-color: red">
  <div style="min-height: 2em; max-width:30em; background-color: black">
    <div style="background-color: white; margin:5em;">
      Where's the margin-top/bottom?
    </div>
  </div>
</body>

My expectation was that the inner div would have the 5 em margin set in all directions.

estani
  • 24,254
  • 2
  • 93
  • 76

0 Answers0