What is the CSS Box Model and what are its components?
The CSS Box Model describes how elements are rendered as rectangular boxes. It consists of four parts from inside out: Content (the actual content), Padding (space between content and border), Border (surrounds the padding), and Margin (space outside the border). The box-sizing property can change how width/height are calculated - content-box (default) doesn't include padding/border, while border-box includes them.
1.box {2 width: 300px;3 padding: 20px;4 border: 5px solid black;5 margin: 10px;6 box-sizing: border-box; /* Total width = 300px */7}