New to CSS? The first order of business is to understand how the box model works. Every element on a page should be seen as a box, with possible paddings, borders and margins. Here’s how it gets applied:
Note that if you apply a box-shadow to an element that’s not an inset box shadow, it’ll show outside the border, no matter the margins.