The box model in CSS defines the structure and how space is allocated around an element. It consists of the following elements:
- Content: The content of the element.
- Padding: The inner space between the content and the element's border.
- Border: The border of the element.
- Margin: The outer space around the element, separating it from other elements.
/* Example of box model */ .element { width: 100px; /* Content width */ height: 100px; /* Content height */ padding: 10px; /* Padding */ border: 5px solid black; /* Border */ margin: 20px; /* Margin */ }