CSS CSS Basics The Box Model Margins

Margin-bottom question

In the Margins video by Guil Hernandez, I'm a little confused on how the margin-bottom is being calculated in the video at 3:54. He said that "we want the margin-bottom to be equivalent to 26px", but I'm confused as to where he's getting that specific number from.

Margins with Guil Hernandez

Can you link to the actual video? Use the Markdown Cheatsheet to format the link

2 Answers

Kevin Faust
Kevin Faust
15,347 Points

All numbers used in these videos are pre calculated. Just do some trial and error until the number with the result you want is achieved

Ricky Simpson
Ricky Simpson
4,652 Points

The Box Model - Margins

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

Above is the in video code. font-size is 53/16 = 3.3125em margin-bottom 26/16 is 1.625em but 0.5em is given in the video. Am I on the correct track to assume it is relative to the font size? 26/53 will give us 0.49em.