The border property
The border
property specifies a color,
type, and width of a border for all sides at
the same time. It is the shorthand property for
border-width
,
border-style
and
border-color
. Unlike
abbreviated properties, it cannot specify a different
border for 4
sides at once, but only
the same one for all.
Syntax
selector {
border: width type color;
}
The order of the properties does not matter.
Example
Let's give the element a black border
with width of 1px
:
<div id="elem"></div>
#elem {
border: 1px solid black;
width: 300px;
height: 100px;
}
:
See also
-
the
border-left
property
that specifies a left border -
the
border-right
property
that specifies a right border -
the
border-top
property
that specifies a top border -
the
border-bottom
property
that specifies a bottom border -
the
outline
property
that sets an outline for an element -
the
border-radius
property
that rounds border corners