Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Basics (2014) 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,353 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.