Skip to content

CSS Box Model

CSS Box Model1

div {
    width: 100px;
    height: 100px;
    padding: 10px;
    border: 1px solid black;
    margin: 10px;
}

Margins

div {
    margin: 10px;
}

Note

Margin is the space outside the border.

Padding

div {
    padding: 10px;
}

Note

Padding is the space inside the border.

Borders

div {
    border: 1px solid black;
    border-top: 5px solid black;
    border-radius: 5px;
}