# Box Model

In addition to setting an element's `height` and `width`, elements have three other properties that explicitly control spacing:

1. 'Padding' specifies spacing between the inside of an element's border and the contents of that element (which includes `height` and `width`!)
2. 'Border' sets a perimeter around an element. In addition to specifying a color and a particular type of border, you can also specify a thickness.
3. 'Margin' specifies spacing between the outside of an element's border and any adjacent elements.

Together, these attributes form *the box model*, a way of describing the space taken up by an element.

![Box Model](https://i.imgur.com/D1WrM6t.png)

By default, the *total size* of an element can be calculated with:

```
`width` = `width` + horizontal `padding` + horizontal `border`
and
`height` = `height` + vertical `padding` + vertical `border`
```

A newer, and arguably better way, is to set the element's CSS [`box-sizing`](https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing) property to `border-box` instead of the default `content-box`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ga0-2.gitbook.io/seifxr10anz-content/day-3-more-html-and-css/box-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
