Style outlineWidth attribute

Definition and usage

outlineWidth Sets or returns the width 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 attributes do not include the outline width.

See also:

CSS Tutorial:CSS Προφίλ

CSS Reference Manual:outline property

HTML DOM Reference Manual:outline property

Example

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 attribute:

object.style.outlineWidth

Set outlineWidth attribute:

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

Attribute value

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

Technical details

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

Υποστήριξη Βrowser

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