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-leftproperty
that specifies a left border -
the
border-rightproperty
that specifies a right border -
the
border-topproperty
that specifies a top border -
the
border-bottomproperty
that specifies a bottom border -
the
outlineproperty
that sets an outline for an element -
the
border-radiusproperty
that rounds border corners