CSS CSS Basics 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,339 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,092 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.