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

HTML DOM Style outline Property

Style outline Property

Style Object Reference The Style object


Definition and Usage

The outline property sets or returns all the outline properties in shorthand form.

Syntax

Set the outline property:

Object.style.outline="

width style color

|inherit"

Return the outline property:

Object.style.outline

**Tip:** The outline property has no default value.

Parameters Description
width Sets the width of the outline.
style Sets the style of the outline.
color Sets the color of the outline.
inherit Specifies that the value of the outline properties should be inherited from the parent element.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the outline property.

**Note:** IE7 and earlier versions do not support the outline property. IE8 supports the outline property only if a !DOCTYPE is specified. IE9 supports the outline property.


Tips and Notes

An outline is a line drawn around an element. It is displayed around the margin of an element. However, it differs from the border property.

An outline is not part of an element's dimensions, so the element's width and height properties do not include the width of the outline.


Example

Example

Change the width, style, and color of the outline around a div element:

Runoob Tutorial(runoob.com)
This is some text.

Note: IE8 support for the outline property requires specifying a !DOCTYPE

Try it »


Style Object Reference The Style object