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

Is instructor choosing random meaningless numbers or is there a science to this?

The instructor uses such specific values like 34 px when adding a margin below the <h2> element. Why not just round it to an even 35px? Is there a science to this, are these really common numbers or is Guil just choosing random numbers?

The same question can be applied to font sizes as well.

2 Answers

Matthew Tran
Matthew Tran
16,343 Points

The numbers were pre-picked to be aesthetically pleasing. They may seem odd, but the 1 px difference between 34px and 35px does matter in the overall scheme of things.

But no, there is no science to the numbers he's choosing, and they aren't typically common numbers.

Thank you @Matthew Tran . I was curious if I should take a typesetting course (which I will), but at least now I know the logic!

Kevin Korte
Kevin Korte
28,148 Points

In addition to this, some designers may or may not use some sort of pattern of increment by say, 4. So they may use numbers like 4, 8, 12, 16, 20, etc.

You could do this with just about any number larger than 1. It's not a hard and fast rule, but it can be a strategy to develop of rhythm in the design.

I don't think Guill uses meaningless numbers. He's an experienced web designer and thus uses many of the numbers from his experience alone. You can achieve this by practicing more and more. He uses many of the numbers to make the subject clear to us and he teaches many of the reasons behind those(if you carry on you'll understand).

And the reason for using font-sizes like that, It depends on the content of the web page, ( so there's no specific rule on that).

Hope that helps. Happy styling !!!
Edit: Later I understood, things are better explained in the "Typography" course on Teamtreehouse.