Style outlineWidth Attribute
- Previous Page outlineStyle
- Next Page Overflow
- Go to the Previous Level HTML DOM Style Object
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 attributes of the element do not include the outline width.
See also:
CSS Tutorial:CSS Outline
CSS Reference Manual:outline attribute
HTML DOM Reference Manual:outline attribute
Example
Example 1
Change the outline width of the <div> element:
document.getElementById("myDiv").style.outlineWidth = "10px";
Example 2
Use the "thick" value to change the outline width of the <div> element:
document.getElementById("myDiv").style.outlineWidth = "thick";
Example 3
Return the width of the <div> element's outline:
alert(document.getElementById("myDiv").style.outlineWidth);
Syntax
Return outlineWidth attribute:
object.style.outlineWidth
Set outlineWidth attribute:
object.style.outlineWidth = "thin|medium|thick|length|initial|inherit"
Attribute 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 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 |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page outlineStyle
- Next Page Overflow
- Go to the Previous Level HTML DOM Style Object