Style outlineStyle attribute

Definition and Usage

outlineStyle The attribute sets or returns the style 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 the 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 Outline

CSS Reference Manual:outline-style property

HTML DOM Reference Manual:outline property

Instance

Example 1

Add a solid outline around the <div> element:

document.getElementById("myDiv").style.outlineStyle = "solid";

Try it yourself

Example 2

Changes the outline style of the <div> element:

document.getElementById("myDiv").style.outlineStyle = "solid";

Try it yourself

Example 3

Returns the outline style of the <div> element:

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

Try it yourself

Example 4

Demonstration of all different values:

var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("myDiv").style.outlineStyle = listValue;

Try it yourself

Syntax

Return the outlineStyle property:

object.style.outlineStyle

Set the outlineStyle property:

object.style.outlineStyle = value

Attribute value

Value Description
none Default. Defines no outline.
hidden The outline is closed.
dotted Defines a dotted outline.
dashed Defines a dashed line outline.
solid Defines a solid line outline.
double Defines a double-line outline. The width of the double line is equivalent to outline-width values.
groove Defines a 3D sunken groove outline. Defines a 3D sunken groove outline. This effect depends on outline-color values.
ridge Defines a 3D sunken groove outline. This effect depends on outline-color values.
inset Defines a 3D sunken outline. This effect depends on outline-color values.
outset Defines a 3D raised outline. This effect depends on outline-color values.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: none
Return value: A string representing the style of the element's outline.
CSS version: CSS2

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support