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 Layout Basics CSS Layout Project Creating and Styling the Layout Containers

Grace kim
Grace kim
499 Points

why h1 is set to margin-top 0 separately but h2 and h3 are given margin-top 0 at the top in base element styles??

Is there any specific reason that the margin-top of h2 and h3 are set to 0 at the top but h1 is not included here. Is there any benefit by setting h1 margin-top to zero later?

1 Answer

Steven Parker
Steven Parker
231,269 Points

At about 1:30 in the video, all of the h1 margins are set to 0 in the ".name" rule, along with the font size. There would be no value in setting just the top margin later, unless you wanted a setting other than 0.

Doing this separately allows only the top margin to be set on the other elements, and also prevents them from being affected by the font size setting.