outline-style property is used to specify the style of an element's outline.
Unlike an element's border (e.g. set using
border or its associated properties), an element's outline does not take up extra space and it can be non-rectangular.
The outline is always on top of a box, and it does not influence the position or size of the box, or of any other boxes. Therefore, displaying or suppressing outlines does not cause reflow or overflow.
User agents typically render an outline on elements in the
outline-style property accepts most of the same values that
border-style accepts, with a couple of exceptions (noted below).
Details on these values below.
- Specifies that the user agent can render a custom outline style. This could be an outline in the default style for the platform, or some other style that's not covered by CSS.
- No outline. Color and width are ignored.
- A series of round dots.
- A series of square-ended dashes.
- A single line segment.
- Two parallel solid lines with some space between them. When using this value, the
border-widthvalue determines the sum of the lines and the space between them.
- Looks as if it were carved in the canvas.
- Looks as if it were coming out of the canvas.
- Looks as if the content on the inside of the border is sunken into the canvas. Treated as
ridgein the collapsing border model.
- Looks as if the content on the inside of the border is coming out of the canvas. Treated as
groovein the collapsing border model.
In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:
- Represents the value specified as the property's initial value.
- Represents the computed value of the property on the element's parent.
- This value acts as either
initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.
- Initial Value
- Applies To
- All elements
The CSS spec warns against removing the outline on elements in the
Keyboard users, in particular people with disabilities who may not be able to interact with the page in any other fashion, depend on the outline being visible on elements in the
:focusstate, thus authors must not make the outline invisible on such elements without making sure an alternative highlighting mechanism is provided.