Frontend Development
About Lesson

The CSS box model is a fundamental concept in web design that describes the rectangular boxes generated for elements on a webpage. Each element is represented as a box, and this box is made up of four parts: content, padding, border, and margin.

  1. Content: This is the innermost part of the box where text or images appear. It’s the area inside the box that displays the element’s actual content.

  2. Padding: Surrounding the content is the padding. It creates space between the content and the border. Padding can be adjusted to control the space within the box, making the content area larger or smaller.

  3. Border: The border wraps around the padding (if any) and content. It’s the outline of the box, and its width, style, and color can be customized. Borders help in distinguishing the element from its surroundings.

  4. Margin: The outermost layer is the margin. It creates space between the element’s border and adjacent elements or the edge of the container. Margins help in positioning elements and controlling the space around them.

Box model
Join the conversation