Style outlineWidth property

Definition and usage

outlineWidth Sets or returns the width of the outline around the element.

The outline is a line around the element. It appears 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:Outline ya CSS

CSS Reference Manual:outline property

HTML DOM Reference Manual:outline property

Instance

Example 1

Change the outline width of the <div> element:

document.getElementById("myDiv").style.outlineWidth = "10px";

Try it yourself

Example 2

Use the "thick" value to change the outline width of the <div> element:

document.getElementById("myDiv").style.outlineWidth = "thick";

Try it yourself

Example 3

Return the width of the <div> element's outline:

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

Try it yourself

Syntax

Return outlineWidth property:

object.style.outlineWidth

Set outlineWidth property:

object.style.outlineWidth = "thin|medium|thick|length|initial|inherit"

Property value

Value Description
thin Defines thin outline.
medium Defines medium outline. Default.
thick Defines thick outline.
length Outline width in length units.
initial Sets this property to its default value. See also initial.
inherit Inherits this property from its parent element. See also inherit.

Technical details

Default value: medium
Return value: String that represents the width of the element's outline.
CSS Version: CSS2

Mwongozo wa kina-vivu

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Mwongozo Mwongozo Mwongozo Mwongozo Mwongozo