CSS Outline
An outline is a line drawn outside the element's border.
CSS Outline
An outline is a line that is drawn around elements, OUTSIDE the borders, to make the element "stand out".
CSS has the following outline properties:
outline-styleoutline-coloroutline-widthoutline-offsetoutline
Note: Outline differs from borders! Unlike border, the outline is drawn outside the element's border, and may overlap other content. Also, the outline is NOT a part of the element's dimensions; the element's total width and height is not affected by the width of the outline.
Example 1: Outline Style
The outline-style property specifies the style of the outline.
A dotted outline.
A dashed outline.
A solid outline.
A double outline.
Example 2: Outline Width
The outline-width property specifies the width of the outline.
Thin outline
Medium outline
Thick outline
4px outline
Example 3: Outline Color
The outline-color property is used to set the color of the outline.
Red outline
Green outline
Yellow outline
Example 4: Outline Offset
The outline-offset property adds space between an outline and the edge/border of an element.
Example 5: Outline Shorthand
The outline property is a shorthand property for setting the following individual outline properties:
outline-widthoutline-style(required)outline-color
A dotted red outline.