CSS - Outline Property




CSS Outline Property

This CSS tutorial explains how to use the CSS property called outline with syntax and examples.

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.

Syntax

The syntax for the outline CSS property is −

outline: outline-width outline-style outline-color;

Parameters or Arguments

outline-width is optional. It is the width of the outline of an element and can be one of the following (If outline-width is not provided, the default is medium)

For Example
Value Description
fixed Fixed value expressed in px, em, ... div { outline-width: 2px; }
thin Thin outline-width, which might be 1px or 2px depending on the browser div { outline-width: thin; }
medium Medium outline-width, which might be 3px or 4px depending on the browser div { outline-width: medium; }
thick Thick outline-width, which might be 5px or 6px depending on the browser div { outline-width: thick; }