Web Lab Documentation

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: border-width border-style 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

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