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 Techniques Grid Layout Creating the Grid Container

Ehsan Raza
Ehsan Raza
263 Points

Hi guys. Can anyone explain to me why Guilh uses padding and margin for grid container? What's the use of it?

I need the answer plz.

2 Answers

Thas Eagans
PLUS
Thas Eagans
Courses Plus Student 2,533 Points

padding adds space between content and border, while margin adds space between different objects (containers, etc).

</TREagans>

yeah what he said.

But basically padding adds to an element, but no content can go inside it. Think of it like a border for a border. Margin is the space between an element, and it's neighbor; in which nothing in the flow of the document is allowed.

I haven't watched the video for awhile(don't have time right now) but it's probably just to suit his layout needs. And add/remove space between elements.