CSS outline Property


The CSS outline property defines the width, line style, and color of the outline of an element. It is a shorthand property for setting the outline-width, outline-style, and outline-color CSS properties.

CSS outline property allows us to draw a line around the element, outside the border.

CSS has following outline properties:

1.Outline-style
2.Outline-color
3.Outline-width
4.Outline-offset

If outline-color is omitted, the color applied will be the color of the text.

Note: The outline is not a part of the element's dimensions, therefore the element's width and height properties do not contain the width of the outline.

CSS Syntax

outline: outline-width outline-style outline-color|initial|inherit;

Supported Browsers: The browser supported by property are listed below:

  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example -