View video tutorial

CSS Outline

CSS

An outline is a line outside the border.

CSS outline property

An outline is a line drawn outside the element boundary.

The attributes are:

  • outline-width
  • outline-style
  • outline-color
  • outline-offset
  • outline

Example

.p1 {
  outline-width: 5px;
  outline-style: solid;
  outline-color: #e40606;
  border: 2px solid black;
}
Try it Now »

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


Sample Code

Copy each file contents and paste it to your own project and run to see the final output

Example

.p1 {
  outline-width: thick;
  outline-style: solid;
  outline-color: #e40606;
  outline-offset: 2px;
  border: 2px solid black;
}
Try it Now »

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