View video tutorial

CSS Border Shorthand

CSS

It is used to shorten the code.

CSS border property

The border property is a shorthand property and is used to set the following properties in order.

  • border-width
  • border-style
  • border-color

Example

.p1 {
  border: 1px solid red;
}
.p2 {
  border: 2px dashed black;
}
.p3 {
  border: 3px double #64070e;
}
Try it Now »

Click on the "Try it Now" button to see how it works.