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 trialOsama Awan
Courses Plus Student 8,676 PointsPadding instead of Margin
Can't we use padding for creating some space instead of margin in h2 and h3.
1 Answer
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsSure you can.
But imagine that the h2 and h3 have borders around them. Lets say 5px would be more than enough.
And now imagine you want to give them a little more space between them.
If you add padding to the elements the borders will still stick together. But by giving them a margin property you separate them from each other.
With padding you expand/decrease the space between the h2 or h3 element to the border. With margin you expand/decrease the space between the h2 or h3 element to the next element in the document flow.
LINK here the bo model is explained and presented.
Hope this helps.