Style outlineColor Property

Definition and Usage

outlineColor Sets or returns the color of the outline around the element.

The outline is a line around the element. It is displayed around the element's margin. However, it is different from border property .

The outline is not part of the element's size, so the width and height properties of the element do not include the outline width.

See also:

CSS Tutorial:Κύκλος CSS

CSS Reference Manual:outline-color property

HTML DOM Reference Manual:outline property

Example

Example 1

Change the outline color of the <div> element:

document.getElementById("myDiv").style.outlineColor = "#00ff00";

Try it yourself

Example 2

Returns the border color of the <div> element:

alert(document.getElementById("myDiv").style.outlineColor);

Try it yourself

Syntax

Return outlineColor property:

object.style.outlineColor

Set outlineColor property:

object.style.outlineColor = "color|invert|initial|inherit"

Property value

Value Description
color

Specifies the outline color.

See CSS color values, for a complete list of possible color values.

invert Reverses the outline color to its opposite value. Default.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: invert
Return value: A string that represents the color of the element's outline.
CSS version: CSS2

browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη