> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/gum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/gum/gum-tool/tutorials-and-examples/examples/padding.md).

# Padding

## Introduction

The concept of padding is often used to add spacing between the edge of a container and its children. Padding can be achieved by adding sub-containers.

## Creating a Container

First we'll create a top-level container. This container controls the size of all objects internally, including the background. We will also include a background object which is sized according to the container. To keep things simple, this example uses a dark blue ColoredRectangle.

The ColoredRectangle is set so its size matches its parent.

<figure><img src="/files/euDr1PR15z9jcO190GFA" alt=""><figcaption><p>Container with a blue background</p></figcaption></figure>

Next we can add another container to the top-level container. By default this container sits at the top-left of the parent when it is added with a drag+drop.

<figure><img src="/files/37n76qyMTnMmugs6X7u2" alt=""><figcaption><p>Container added with drag+drop</p></figcaption></figure>

To have the container fill its parent, but also include padding:

1. Select the inner container
2. Click the Alignment tab
3. Enter the desired padding in the Margin text box
4. Click the Dock Fill button

<figure><img src="/files/mlLyloTNBPtucEGUaAKe" alt=""><figcaption><p>Creating padding by havign an internal continer use Margin of 10</p></figcaption></figure>

This inner container can now be used to hold all children. Note that if you are creating a Component and you want to make this be the default container for children, you may want to set the Default Child Container to this inner container. For more information see the [Default Child Container](/gum/gum-tool/gum-elements/component/default-child-container.md) page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.flatredball.com/gum/gum-tool/tutorials-and-examples/examples/padding.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
