Border

Category:CSS Properties

Border

The border property specifies the style, width, and color of an element's border. It is a shorthand property for border-width, border-style, and border-color.

Examples

Border Property

Setting a <h1> element to a solid red border of 5 pixels width.

h1 {
  border: 5px solid red;
}

Syntax

border: border-width border-style border-color;

Tips

  • If border-style value is not provided, the default is no border.
  • If no border-color value is chosen, the border color will match the color of the text.
  • If border-width value is not provided, the default is medium.

Additional Information

For more information, see https://www.w3schools.com/cssref/pr_border.asp

Found a bug in the documentation? Let us know at documentation@code.org