Borders
Learn all about how to place borders around elements.
The border
property
The border surrounds an element between the padding and margin. We can use it to draw an edge around an element. We use the border-width
, border-style
, and border-color
properties to define our border
.
Border width
The border-width
property defines the border’s thickness.
p {
border-width: 2px;
}
Alternatively, we could set each edge (top -> right -> bottom -> left) separately, like so:
p {
border-width: 2px 1px 2px 1px;
}
We can also use the following values:
- The
thin
value is1px
- The
medium
value is3px
- The
thick
value is5px