Into The CSS Box Model
CSS is very useful for web design and the fundamental knowledge of the CSS box model is necessary to obtain a basic understanding of CSS overall.
The uplifting news is, whether you can pack a box, all things considered, you can comprehend the CSS box model. What's more, on the off chance that you can't pack a box, all things considered, because of some traumatic physical injury, you shouldn't have quite a bit of an issue, either. Likewise, I'm sad about raising the entire box thing.
So what's the box model? The box model is a settled upon set of standards for how web browsers will show (model) the content (boxes) on a page. What's more, what does that need to do with you? All things considered, on the off chance that you need to style the content on your site, it's a smart thought to know how the standards you compose will be shown.
So here are the most fundamental properties you need to stress over when managing the box model: background, border, padding, margin and width. We'll experience these properties one by one further. Furthermore, to enable it to bode well, we'll relate it to how you'd pack a container, in actuality.
- Border- This is the box. When you're beginning, it thinks about the border as the outline of a genuine box. It can have diverse thicknesses (widths) and colors, yet its fundamentally only a rigid structure you place things into.
- Padding- Consider padding as the bubble wrap or packing peanuts you'd add to a container before delivering it some place. Padding lies between your border and your content. This is the sanest property of the part.
- Width- This is the width of your content in your box. This can be fairly unreasonable at to begin with, in light of the fact that it is not the width of your border.
- Background- On the off chance that you apply a background to something, it extends from one side of the border to the next, covering the whole within your box. Additionally, on the off chance that you apply both a background color and a background image, the image will sit on top of the color.
- Margin- Margins exist outside of our imaginary box, around your border.