> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/css/box-model/margin/layout.md).

# layout with margin

{% tabs %}
{% tab title="codepen" %}
{% embed url="<https://codepen.io/lochiwei/pen/JjJPjWm>" %}

{% endtab %}

{% tab title="CSS" %}

```css
div {
    width: 100px;
    height: 50px;
    box-sizing: border-box;
    border: 1px solid black;
    background-color: #e66;
}

.div2, .div5 {
    background-color: #6e6;
}

.div3, .div6 {
    background-color: #66e;
}

.div2 {
    margin-left: 100px;
}

.div3 {
    margin-left: 200px;
}

.div5 {
    position: relative;
    left: 100px;
}

.div6 {
    position: relative;
    left: 200px;
}
```

{% endtab %}
{% endtabs %}
