Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS outline property

CSS outline property

Example

Set the outline around an element:

p

{

outline:

#00FF00

dotted

thick

;

}

Try it »


Property definition and usage

An outline is a line drawn around an element, outside the border edge, which can highlight the element.

The outline shorthand property sets all outline properties in a single declaration.

The properties that can be set are (in order): outline-color, outline-style, outline-width

It is fine to omit one of the values; for example, outline:solid #ff0000; is allowed.

Default value: invert none medium
Inherited: no
Version: CSS2
JavaScript syntax: object.style.outline="#0000FF dotted thin"

Browser support

The numbers in the table indicate the first browser version that supports this property.

property
outline 1.0 8.0 1.5 1.2 7.0

Attribute values

Value Description
outline-color Specifies the color of the border. See:outline-color Possible values.
outline-style Specifies the style of the border. See:outline-style Possible values.
outline-width Specifies the width of the border. See:outline-width Possible values.
inherit Specifies that the outline property should be inherited from the parent element.

Related Articles

CSS Tutorial: CSS Outline