CSS outline-width property
Example
Set the width of the outline:
p
{
outline-style:
dotted
;
outline-width:
5
px
;
}
Try it »
Property definition and usage
An outline is a line drawn around an element, outside the border edge.
The outline-width property specifies the width of the outline.
Note: Always declare the outline-style property before the outline-width property. An element can only change its outline width after it has an outline.
| Default value: | medium |
|---|---|
| Inherited: | no |
| Version: | CSS2 |
| JavaScript syntax: | object.style.outlineWidth="thin" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| outline-width | 1.0 | 8.0 | 1.5 | 1.2 | 7.0 |
Tips and Notes
An outline is around the element. It is a margin around the element. However, it comes from a different border property.
An outline is not part of the element's dimensions, so the element's width and height properties do not include the width of the outline.
Attribute values
| Value | Description |
|---|---|
| thin | Specifies a thin outline. |
| medium | Default. Specifies a medium outline. |
| thick | Specifies a thick outline. |
| length | Allows you to specify the thickness of the outline. |
| inherit | Specifies that the outline width should be inherited from the parent element. |
Related Articles
CSS Tutorial: CSS Outline
CSS Reference Manual: outline property