Margins and padding cause a lot of confusion amongst new developers. This video is the start of a deep dive miniseries taking a look at them.
This video is really a look at the very basics of margins and padding, what each one do, and what the differences are between the two of them.
I also take a look at how auto margins work, and why & how we can use them to center something vertically on the screen. In this section though, I did forget to mention that for these to work, the element also needs to have an assigned width as well (thanks to Jon for pointing that out in the comments)!
Part 1: The Very Basics (this video)
Part 2: Collapsing margins and box-sizing - [ Ссылка ]
Part 3: Using Whitespace effectively - [ Ссылка ]
---
My Code Editor: VS Code - [ Ссылка ]
How my browser refreshes when I save: [ Ссылка ]
---
Support me on Patreon: [ Ссылка ]
I'm on some other places on the internet too!
If you'd like a behind the scenes and previews of what's coming up on my YouTube channel, make sure to follow me on Instagram and Twitter.
Instagram: [ Ссылка ]
Twitter: [ Ссылка ]
Codepen: [ Ссылка ]
Github: [ Ссылка ]
![](https://s2.save4k.ru/pic/EhbZGV2dqZ4/maxresdefault.jpg)