CSS outline properties
With CSS outline properties, you can specify how lines appear around elements outside of a borders edge. All of the examples on this page have a red border and an outline outside of the borders edge to illustrate how an outline is displayed relative to a border.
This tutorial focuses on:
- Setting the style of an outline
- Setting the width of an outline
- Setting the color of an outline
Setting the style of an outline
The style of an outline is set with the outline-style property.
Possible values for the outline-style property: dashed, dotted, solid, groove, double, outset
This text has a dashed outline
This text has a double outline
This text has a dotted outline
This text has a groove outlineSetting the width of an outline
The width of an outline is set with the outline-width property. The values you can assign to this property include "thin", "medium", "thick", or a custom value.
This text has a thin dashed outline
This text has a medium double outline
This text has a thick dotted outline
This text has a groove outline that has a thickness of 10 pixelsSetting the color of an outline
The color of an outline is set with the outline-color property. The values you can assign to this property include a color name, an RGB value, or a hexadecimal value.
This text has a green dashed outline
This text has a darkolivegreen double outline
This text has a gray dotted outline
This text has a teal groove outline