CSS CSS Basics The Box Model Margins

Margin confusion

body { color: #878787; margin: 0; font: 1em/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; }

h2 { font-size: 3.3125em; /* 53px/16px / font-weight: normal; line-height: 1.1; margin-bottom: .5em / 24px */ }

here, why should we divide margin-bottom 24px by font-size 53px since h2 parent is body so I think shouldn't margin-bottom 24px divide by font 16px ? Thanks in advanced :)

Kjetil-Lennart A. Lorentzen
Kjetil-Lennart A. Lorentzen
13,388 Points

em - Relative to the font-size of the element (2em means 2 times the size of the current font)

When you put em's on margins it will use it's own font-size to measure.

It looks to be in a div container. Possibly why. It is also has the wildlife class. So it appears to separate the two. It puts it in its own box. Also, the size is relative, 1 (rem) is 16px. Ems irritate me.