CSS Borders
The CSS border properties allow you to specify the style, width, and color of an element's border.
border-style
The border-style property is required to make a border visible. It can have values like dotted, dashed, solid, double, groove, ridge, inset, outset, or none.
Example
p {
border-style: dotted solid double dashed;
}border-width
The border-width property specifies the width of the four borders. It can be set in pixels, pt, cm, em, etc., or by using one of the three pre-defined values: thin, medium, or thick.
Example
p {
border-style: solid;
border-width: 5px;
}border-color
The border-color property is used to set the color of the four borders. You can specify a single color for all sides, or different colors for each side.
Example
p {
border-style: solid;
border-color: red green blue yellow; /* top right bottom left */
}Border Shorthand
The border property is a shorthand for setting the individual border properties: border-width, border-style, and border-color.
Example
p {
border: 5px solid red;
}Test Yourself with an Exercise
Which property is required to display a border?